Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Location
  • Activity

NicePack's Achievements


Newbie (1/14)




Community Answers

  1. Edited the main post and marked issue as solved. Thanks againg for your help!
  2. Oh My fucking God Eolia it worked! May be God or Zinedine Zidane bless you. Now I have a meeting but when arrive at home again i'll post a resume for anyone who need something similar and mark post as solved. Please don't close it yet.
  3. Thx! I'll try this and give a feedback. Hope it works and if it does I'll resume all solution.
  4. Sorry Eolia! Had a crazy busy day yesterday I've tried your proposed solution and indeed it gives me acces to count nb_attributes (or combinations) from product-list.tpl but seems I should not comment the CategoryController block since if I do that for some reason I loose all products in my Categories. Only can see the ones in Home in the Featured Products module. What does this comment disable exactly? Maybe I have some changes in my website that affects this comment (I'm using PS by the way). Its curious because if I don't comment this I can't print the nb_attributes only on products in Featured Products module as if I couldn't access it from any category that's not Home category. Anyway don't doub I apreciate a lot your efforts! I'm aware that this shouldn't be an easy question/request :/
  5. Ok, now I see, seems that I can only read combinations inside product.tpl. I'm working on product-list.tpl to choose if I put a {l s='From'} before prices in the product list pages. Now I supos that the ight question is: Is not possible to know if a product has combinations in the product-list.tpl?
  6. Definitely it seems that I don't have any "combinations" variable available to read from my product-list.tpl. I've put your script but browser's console says that: ReferenceError: combinations is not defined. So I think that it can't read combinations.length Arg, didn't though it was that hard to read how many attribute combinations has one product. Anyway thanks for your patience guys, I'll keep investigating.
  7. Tried this but I got always that $combinations is "1" and this is not true I have products with only 1 size combination and other with 4 sizes. What $combinations variables would be referring? Sorry but dont understand this, should I put this on my product-list.tpl? How I make an if statement with nb value then? I don't know how to mix language sintaxis in a same file
  8. Hey thanks for the response! But didn't worked Is it possible that variable $combinations doesn't exist? I doesn't enter the statement either isset($combinations) && count($combinations) > 1 or isset($combinations) && count($combinations) > 0 and happens with all products. Thx for helping anyway!
  9. Hi, I would edit product-list.tpl to change in wich product prices I show the {l s='From'} string and I need to know how many attribute combinations has a product. The thing is that if a product has combinationsNumber > 1, I show {l s='From'} before my price value. But if it has 1 or less combinations i don't show it. Actually my code only looks if there is a combination like this: {if isset($product.id_product_attribute)} {l s='From'} {/if} {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} But I would know how to check an specific number of combinations. Thanks for any help! ^^ EDIT with solution: Let's make a short explanation of this post for people who might need something similar. I need to get the number of products combinations in the categories lists of my website to decide if I put a 'From' string before prices (for products with combinations of diferent prices) or not (for products with only 1 combination and only one price). Problem is that product-list.tpl (the file that shows the list of products per category) seem not to be prepared to know the number of combinations of a product. Then you need to do this: Edit file classes/Category.php and replace the first block (line 660) by this other SQL query where you get the number of combinations of a product as nb_attributes variable: $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, COUNT(DISTINCT pa.`id_product_attribute`) AS nb_attributes, MAX(product_attribute_shop.id_product_attribute) id_product_attribute, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, pl.`description`, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` AS manufacturer_name, cl.`name` AS category_default, DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new, product_shop.price AS orderprice FROM `'._DB_PREFIX_.'category_product` cp LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product`) '.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1').' '.Product::sqlStock('p', 'product_attribute_shop', false, $context->shop).' LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (product_shop.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').') LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'. Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').' LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.') LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` WHERE product_shop.`id_shop` = '.(int)$context->shop->id.' AND cp.`id_category` = '.(int)$this->id .($active ? ' AND product_shop.`active` = 1' : '') .($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') .($id_supplier ? ' AND p.id_supplier = '.(int)$id_supplier : '') .' GROUP BY product_shop.id_product'; Then, to make this affect to categories edit too modules/blocklayered/blocklayered.php, line 1988 and replace this: SELECT p.*, '.($alias_where == 'p' ? '' : 'product_shop.*,' ).' by this: SELECT p.*,COUNT(DISTINCT pa.`id_product_attribute`) AS nb_attributes, '.($alias_where == 'p' ? '' : 'product_shop.*,' ).' Now you have your $product.nb_attributes variable accessible in product-list.tpl! Edit product-list.tpl and go near line 132 where is showing prices and offer prices and change: {if isset($product.id_product_attribute)} by {if isset($product.id_product_attribute) && isset($product.nb_attributes) && $product.nb_attributes > 1} And thats all! Thanks again to Eolia and FullCircles for given help ^^
  10. Ok, if I'm not wrong it seem that I must change something in StoresControlles.php. I've seen this code: public function initContent() { parent::initContent(); if (Configuration::get('PS_STORES_SIMPLIFIED')) $this->assignStoresSimplified(); else $this->assignStores(); $this->context->smarty->assign(array( 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'defaultLat' => (float)Configuration::get('PS_STORES_CENTER_LAT'), 'defaultLong' => (float)Configuration::get('PS_STORES_CENTER_LONG'), 'searchUrl' => $this->context->link->getPageLink('stores'), 'logo_store' => Configuration::get('PS_STORES_ICON') )); $this->setTemplate(_PS_THEME_DIR_.'stores.tpl'); } I think that if I Kill this If statement and assing $this->assignStores(); I'll get one unique result. But don't know how to get map and stores list in assignStores() function Well to be fair I'm not sure if that's the solution. I'll keep looking for it.
  11. Hi, I'm using P1.6 and I've seen that it's back office allows me to show "Our Stores" page in two different ways: 1) A list of my saved stores -or- 2) A Google Map with a search box with my stores located in there. And if I search some location it shows a list with the stores in location. But is there a way (or module) to show both map and list without searching? I've seen that in stores.tpl there's an If statement that chooses between map or "list" I tried to merge all code lines oustside list but it doesn't work. It have priority what I've chosen in the backoffice options. If it's usefull some example I would do something like this: http://www.lamallorquina.es/en/content/6-shops (also in this example you can pick the name of a shop and it shows in the map but I think that this is a futur problem that I'll have to fight ) Any suggestion? Thanks!
  12. Hey Vekia it worked! In fact I tried something similar but the trick was to remove this part "width="{$homeSize.width}" height="{$homeSize.height}" I looks nice now ^^ Do you know where can I do the same with the inside product image? There's no "home-default" tag in product.tpl. No need, editet ProductController.php to call my custom product.tpl and changed "large_default" image tag by my custom tag. Thanks for all help!
  13. Arg, still fighting for it Haven't anyone pass trought a different layout with products with different image size than rest of the shop? Something like this (attached file)
  14. Arg, I thought it was quite simple Yes I wanted to use images of 456x578px on HOMEWEAR and keep my 218x218px images on the rest of the site. Or what's the same use squared images on my site but rectangular vertical on HOMEWEAR. I've already created a folder (theme/layouts/categories/homewear) and changed CategoryController.php to read only my custom category.tlp and product-list.tlp for HOMEWEAR and read the original files for the rest of the site. Don't know if this helps to do it easier
  15. Sorry, forgot it. I'm working on PS and the default-bootstrap template. Website is this one: lamallorquina.onesixstudio.com/en/ And what I want is to have a 2 columns (already done) of 456x578px images (already created in Preferences/Images) in "HOMEWEAR" category.
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More