Forum

Thread tagged as: Question, Field-Types, Shop

Still having trouble with brands and products

When I'm trying to display the brand with my product all I'm getting is the brandID, but what I want is the brandTitle.

<perch:shop id="brand" type="text" label="title">

I'm not sure how I can access more from the brand's database.

Cameron Hattendorf

Cameron Hattendorf 0 points

  • 3 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Cameron,

You need to use type="shop_brand":

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

This is included in the default product template templates/shop/products/product.html.

but when I try to recall the brand in a template or in the slug using this id, I only get a number. I need to be able to access the brandTitle and would prefer to use the native brand app.

I have thought of using dataselect to call from the section on my homepage that all of the bicycle brands are listed after I set that part of the site up. That seems unnecessary though.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

I assumed you were using perch_shop_product() to display the product and wanted to include the brand title in the same template.

What are you using? Can you show us your code?

Oh, nvm that does work. I just hadn't tested it on that end. Whew thanks.

second part of the question: How can I get the brand title into the product's slug? That is where my difficulty and recent confusion originated.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

I'm not sure whether this can be done. You can however add the brand's ID to the product slug by modifying the for attribute on the slug's tag in product.html:

<perch:shop id="slug" type="slug" editable="true" indelible="true" label="Slug" for="title sku brand" />

That's what I was suspecting. I think I may try to use a data select route. May clear it all up for me. Thank you for the super quick replies!