MichalT Posted April 19, 2020 Share Posted April 19, 2020 Hello, Say I need to reference product qty in if statement within a tpl file. I would write the following: {if $product.quantity > 0} etc. That means, the quantity for a product is called using variable $product.quantity. Can someone tell me name of the variable for supplier ID? I tried $suplier.id_supplier, $id_supplier, etc, but nothing works. Presta version 1.7.5.1 Thanks Link to comment Share on other sites More sharing options...
EvaF Posted April 20, 2020 Share Posted April 20, 2020 did you try $product.id_supplier ? Link to comment Share on other sites More sharing options...
MichalT Posted April 20, 2020 Author Share Posted April 20, 2020 Yes, but did not work. I asked someone else to look into it and was told that the supplier id in the ps_product table is not populated with the supplier data even though the supplier was created and selected in BO product page. The data actually flows into different table "product supplier". So as a work around a code will be added which will ensure that if supplier is added to the product in BO, this will update table ps_product. That will then allow me to use $product.id_supplier. Link to comment Share on other sites More sharing options...
EvaF Posted April 20, 2020 Share Posted April 20, 2020 I am a little confused - why do not you complete suppliers(enabled) into products? and Link to comment Share on other sites More sharing options...
MichalT Posted April 20, 2020 Author Share Posted April 20, 2020 I was not thinking along these lines because from the outset I thought of using supplier id, which is an integer. What you suggest is supplier reference. But I tried it now and ps_product table in the database does not get updated with the data (column supplier_reference) therefore $product.id_supplier will not return any value if used in tpl file. Link to comment Share on other sites More sharing options...
EvaF Posted April 20, 2020 Share Posted April 20, 2020 (edited) no, if you set suppliers in Product/Options, then default supplier is stored in the table ps_product and all selected suppliers are stored inps_product_supplier table Edited April 20, 2020 by EvaF (see edit history) Link to comment Share on other sites More sharing options...
MichalT Posted April 20, 2020 Author Share Posted April 20, 2020 Oh my... it works. I have not ticked off the default supplier option, only the "Choose the suppliers..." You have my gratitude. Thank you! 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