Forum

Thread tagged as: Question, Configuration, Shop

product brands showing only designated number

$Listing->add_col([\
            'title'     => 'Brand',
            'filter'    => 'brand',
            'value'     => 'brand',
            'sort'      => 'brand',
        ]);

I'm trying to display the product's brand in a column by editing product.list.post.php. when I put this in I only get a number. In fact the number of the order the brand was put into the system. I tried putting 'shop_brand' and brand.Title or .Slug in and I don't get an error, but I don't even get a number at that point. Any help would be very much appreciated.

Cameron Hattendorf

Cameron Hattendorf 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

That's the brand's ID in its related table. The brand name isn't readily available at that point. We also don't support modifications to our software. If you want something custom, you'd be better to use the API to implement your own app, or use something like Pipit Catalog.

https://grabapipit.com/pipits/apps/catalog

That is exactly what I needed. Next question(related): is there a way to transfer the brand name selected from the dropdown in the product master template to the slug? right now I'm only able to use the id.

Hi Cameron

It's impossible to say exactly how to do this as we don't know your site's structure. I see Shop as more an ecommerce framework than a prescripted "shop in a box" type product.

However, if you are trying to hook a brand page up into the url then using routes is a good way to go. You should use the brand slug as it's "urlified" not the title. (I think routes needs Perch Runway but can't remember off the top of my head as that's all I use now!)

Set up a brand page template. Enter shop/[slug:brand] as a route (or whatever your page structure is) into the location settings for the page.

And then look for the slug in the url on your brand page, so that you serve up the associated brand when the url is called by filtering using the brand slug e.g.

perch_shop_brand(perch_get('brand'), [
     'template' => 'brands/brand_detail.html',
]);

You can then filter products on that brand page, based upon the brand they are associated with, e.g.:

perch_shop_products([
'template' => 'products/product_list.html',
'variants' => true,
'filter' => 'brand.slug',
'match' => 'eq',
'value' => perch_get('brand')
]);

You can see this set up in action here:

https://ellipress.co.uk/shop/tnb

Brand info is at the top. Product listing is below it filtering by brand.

I hope that gets you started.

Jon

<perch:shop id="slug" type="slug" editable="true" indelible="true" label="Slug" for="brand title" order="10" divider-before="Meta data" />

<perch:shop id="brand" type="shop_brand" label="Brand" required="true" />

What I mean to ask, is there a way to get the name of the brand i selected in the shop_brand fieldtype to show up in the slug. Right now this does nothing for the brand and only the number in the array shows up (which is 2) alog with the title. The website is for a bike shop. for example we sell the Magnum (brand) Metro (model). I'd like this to be in the slug to simplify the process (hopefully).

Also: I'm not really using the sop api as an ecommerce solution, more of a way for the shop to easily manage 'profiles for each of the bikes we sell, then have that dynamically generated throughout the site. Customers will then come into the shop to purchase our products.