wzr1one Posted December 4, 2016 Share Posted December 4, 2016 (edited) Witam, chciałem dodać mały warunek w product-list.tpl oraz dwóch modułach - blocknewproducts oraz blockviewed wygląda on w ten sposób: {$product->id_supplier == 1} cośtam {else} cośtam {/if} Wyrzuca mi to błąd Notice: Trying to get property of non-object in .../tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 98 Zastanawiam się, gdzie powinienem zmienić i co powinienem zmienić, aby to zaczęło mi działać? Pozdrawiam! Korzystam z wersji prestashop 1.6.1.9 Edited December 5, 2016 by wzr1one (see edit history) Link to comment Share on other sites More sharing options...
e_com Posted December 4, 2016 Share Posted December 4, 2016 {$product.id_supplier} {$newproduct.id_supplier} {$viewedProduct->id_supplier} Link to comment Share on other sites More sharing options...
wzr1one Posted December 4, 2016 Author Share Posted December 4, 2016 (edited) Działa wszystko, poza viewedProduct->id_supplier Masz na to jakies rozwiązanie? Poza tym dziękuję bardzo ! edit. zwraca błąd taki - : Undefined property: stdClass::$id_supplier in Edited December 4, 2016 by wzr1one (see edit history) Link to comment Share on other sites More sharing options...
e_com Posted December 4, 2016 Share Posted December 4, 2016 Strzelałem przez analogię , ale niestety kontroler modułu blockviewed nie pobiera id_supplier. Trzeba zmodyfikować zapytanie do bazy: SELECT MAX(image_shop.id_image) id_image, p.id_product, p.id_supplier, il.legend, product_shop.active, pl.name, pl.description_short, pl.link_rewrite, cl.link_rewrite AS category_rewrite I do obiektów dodać: $obj->id_supplier = (int)($productsImagesArray[$productViewed]['id_supplier']); Link to comment Share on other sites More sharing options...
wzr1one Posted December 5, 2016 Author Share Posted December 5, 2016 (edited) Kolego, otrzymałem również na angielskiej wersji forum rozwiązanie, które zadziałało i zapomniałem tu zajrzeć Jakby ktoś potrzebował - Oops, sorry, my bad. It should be {$viewedProduct->id_supplier} indeed. But you have to make some changes in /modules/blockviewed/blockviewed.php first: Replace line 83: SELECT MAX(image_shop.id_image) id_image, p.id_product, il.legend, product_shop.active, pl.name, pl.description_short, pl.link_rewrite, cl.link_rewrite AS category_rewrite with this: SELECT MAX(image_shop.id_image) id_image, p.id_product, p.id_supplier, il.legend, product_shop.active, pl.name, pl.description_short, pl.link_rewrite, cl.link_rewrite AS category_rewrite Around line 116, after: $obj->category_rewrite = $productsImagesArray[$productViewed]['category_rewrite']; add this: $obj->id_supplier = $productsImagesArray[$productViewed]['id_supplier']; Then in the tpl file you can use {$viewedProduct->id_supplier} Let us know if this works. Remember to apply these changes with an override if you don't want to lose them with updates. Edited December 5, 2016 by wzr1one (see edit history) 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