smartrich Posted July 14, 2015 Share Posted July 14, 2015 This is probably simple, but I'm stuck. I've added some accessories, but wanted to include the model number which I have changed to part number. http://192.185.4.162/~kmsafari/index.php?id_product=32&controller=product&id_lang=1 (bottom of the page) In the product.tpl file I added this code: <p id="product_reference" style="font-weight:bold" {if empty($product->reference) || !$product->reference} style="display: none;"{/if}> <label>{l s='Part'} </label> <span class="editable" itemprop="sku">{if !isset($groups)}{$product->reference|escape:'html':'UTF-8'}{/if}</span> </p> Because I use the word "product", the part number that shows is the number of the product for that page. The word needs to be something else that identifies the accessory, but I'm not sure what. Can anyone help? TIA. ~rich Link to comment Share on other sites More sharing options...
razaro Posted July 14, 2015 Share Posted July 14, 2015 Try to use variable $accessory . I am guessing you are editing this part of code https://github.com/PrestaShop/PrestaShop/blob/develop/themes/default-bootstrap/product.tpl#L508 Link to comment Share on other sites More sharing options...
smartrich Posted July 14, 2015 Author Share Posted July 14, 2015 Yes, that's the part of the code I am editing. The variable accessory is the first thing I tried ... this is what I get back: Notice: Trying to get property of non-object in /home1/kmsafari/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(171) : eval()'d code on line 884 Link to comment Share on other sites More sharing options...
razaro Posted July 14, 2015 Share Posted July 14, 2015 Well think you use . instead -> so try $accessory.reference Link to comment Share on other sites More sharing options...
smartrich Posted July 14, 2015 Author Share Posted July 14, 2015 That was the second thing I tried ... with the same result. Part Notice: Trying to get property of non-object in /home1/kmsafari/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(171) : eval()'d code on line 884 Link to comment Share on other sites More sharing options...
razaro Posted July 14, 2015 Share Posted July 14, 2015 Ok figured one thing, because of use of that id="product_reference" reference is set to main product one with jQuery. Also if product have combination then reference part will be hidden so maybe delete that {if !isset($groups)} ...{/if} and leave just {$accessory.reference|escape:'html':'UTF-8'} Which works for me. Or move that if before whole block if you want to hide it. Link to comment Share on other sites More sharing options...
smartrich Posted July 14, 2015 Author Share Posted July 14, 2015 Razaro, You are an awfully nice guy to spend all the time with this. I fussed with it all morning with no success. Your solution works perfectly. Thanks so much for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now