Jump to content

Binded

Members
  • Posts

    2
  • Joined

  • Last visited

Profile Information

  • Location
    Germany
  • First Name
    Binded
  • Last Name
    Binded

Recent Profile Visitors

174 profile views

Binded's Achievements

Newbie

Newbie (1/14)

8

Reputation

  1. Me or other any developer in here could easily solve your problem, but I think it would be much more valuable to give you a hint: You have an error in the sql query. My original query works with 1.6.1.4, you can use it as a reference.
  2. Hello, sharing a "hacky way" that works on ps 1.5 & ps 1.6. I Hope it will lead someone to making it as a nice solution for a client. This should not be used as a permanent solution. If the blocklayered module gets update, the code will get overwritten. P.S. the particular code works with all of the attributes, not only the color. Edit /modules/blocklayered/blocklayered.php 1. Put this in the function ajaxCall() after the line $this->getProducts(...) if (isset($selected_filters['id_attribute_group']) && $selected_filters['id_attribute_group']) { $this->switchProductImages($selected_filters, $products); } } 2. Put these at the very end of the file (before closing curly brace) private function switchProductImages($selected_filters, &$products) { foreach ($products as &$product) { foreach($selected_filters['id_attribute_group'] as $key => $value) { $attributeImageId = $this->getProductImage($product['id_product'], $key); if((int)($attributeImageId) > 0) { $product['id_image'] = $product['id_product'].'-'.$attributeImageId; } } } } private function getProductImage($id_product, $id_attribute) { $query = 'SELECT `id_image` FROM `ps_product_attribute_combination` INNER JOIN `ps_product_attribute` ON `ps_product_attribute`.`id_product_attribute` = `ps_product_attribute_combination`.`id_product_attribute` INNER JOIN `ps_product_attribute_image` ON `ps_product_attribute_image`.`id_product_attribute` = `ps_product_attribute`.`id_product_attribute` WHERE `id_attribute` = \''.$id_attribute.'\' AND `id_product` = \''.$id_product.'\''; return DB::getInstance()->getValue($query); }
×
×
  • Create New...