seog Posted April 2, 2017 Share Posted April 2, 2017 Hola gente Deseo añadir un icono en el product list de "FavoriteProducts" y seguí los siguientes pasos: En product-list.tpl justo debajo de {if isset($product.on_sale) && $product.on_sale && <ul id="usefull_link_block" class="only-icon"> {if !$isCustomerFavoriteProduct} <li id="favoriteproducts_block_extra_add" rel="{$product.id_product}" class="add"></li> {/if} {if $isCustomerFavoriteProduct} <li id="favoriteproducts_block_extra_remove" rel="{$product.id_product}"></li> {/if} <li id="favoriteproducts_block_extra_added" rel="{$product.id_product}"></li> <li id="favoriteproducts_block_extra_removed" rel="{$product.id_product}"></li> </ul> En CategoryController.php en la variable public function initContent() public function initContent() { parent::initContent(); $this->setTemplate(_PS_THEME_DIR_.'category.tpl'); if (!$this->customer_access) { return; } if (isset($this->context->cookie->id_compare)) { $this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare)); } if (Module::isEnabled('favoriteproducts')) { include_once(_PS_ROOT_DIR_ . '/modules/favoriteproducts/FavoriteProduct.php'); foreach ($this->cat_products as &$cat_product) { $cat_product['isCustomerFavoriteProduct'] = (FavoriteProduct::isCustomerFavoriteProduct($this->context->customer->id, $cat_product['id_product']) ? 1 : 0); }} // Product sort must be called before assignProductList() $this->productSort(); Obtuve en el product-list el mismo codigo del product.tpl pero si clicko en un producto para añadir a favoritos desde las categorias no lo añade, es como si el JS no funcionase y creo que el problema podría estar en el lugar donde añadi el codigo en el CategoryController.php Algún consejo? NOTA: Comprobe esto y esto pero sin ningún exitoPS 1.6.1.11 & FavoriteProducts V1.3.1 Link to comment Share on other sites More sharing options...
shacker Posted April 7, 2017 Share Posted April 7, 2017 hazlo asi https://belvg.com/blog/how-to-create-a-wishlist-on-a-category-page-in-prestashop.html Link to comment Share on other sites More sharing options...
Prestaprof Posted June 6, 2017 Share Posted June 6, 2017 hazlo asi https://belvg.com/blog/how-to-create-a-wishlist-on-a-category-page-in-prestashop.html Eso en realidad es para añadir a la lista de deseos, ¿alguien sabe como hacer para añadir a favoritos desde la vista de categorías? 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