Jump to content

NicePack

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by NicePack

  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 1.6.0.7 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 1.6.0.9 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.
  16. Hi, as I posted here I've followeb a tutorial to use a different layout per category and at this moment it is working nice to me. I've done something simple in most categories of my shop, I show a product-list.tpl with 4 product columns but in an specific one my custom product-list.tpl shows 2 columns. Now I would assign the diferent image sizes that I've created on Back Office/Preferences/Images to my new custom layout so they appear in my product list images and inside my products image. I haven't found this lines in product-list.tpl, do you know what I need to modify? Thanks in advance and hope to explained well my issue!
  17. Sorry to bother you again. I try to show the price under ProductName but no success. It seems that you have a hidden line {*convertPrice price=$peleRelatedProduct.displayed_price*} I unmarket it but it happened nothing. I also tried to copy/paste the lines on productscategory.tpl <p class="price_display"> <span class="price{if isset($categoryProduct.specific_prices) && $categoryProduct.specific_prices} special-price{/if}">{convertPrice price=$categoryProduct.displayed_price}</span> {if isset($categoryProduct.specific_prices.reduction) && $categoryProduct.specific_prices.reduction && $categoryProduct.specific_prices.reduction_type == 'percentage'}<span class="price-percent-reduction small">-{$categoryProduct.specific_prices.reduction * 100}%</span>{/if} {if isset($categoryProduct.specific_prices) && $categoryProduct.specific_prices}<span class="old-price">{displayWtPrice p=$categoryProduct.price_without_reduction}</span>{/if} </p> But no luck either. Is there any way to show price with the module?
  18. Excuse me Enrique, do you know in wich file can I change the name of related products to not truncate them (show full name)? Thanks for any help!
  19. Hi, this is a simple question. I want to use different image sizes in differents categories for my website and I've found this nice tutorial in internet: http://digitaldisseny.com/en/blog/195-prestashop-different-layouts-per-category But since it is from 2012 and it seems to need a lot of code and structure hacking I don't know if it is a good way to solve my issue or if there's another options in PS 1.6. Thx in advance. I've improved a lot my PS knowledge thanks to this forums!
  20. Hey! I'v just found this post and it's been great to me ^^ All these days fighting against header (or top) blocks and at least found a solution to center logo and another to hook search bar block and social block in new places. Yay, thanks a lot! But I have a little issue with this Logo solution, is is responsive (at leat to me) since a determinated screen size, when I look on mobile screen sizes the logo goes big again and its outside of screen from the right. Do you know what's happening? If needed url is lamallorquina.onesixstudio.com and I attach screenshot.
  21. It's a little bit hard Thx to El Patron advices, finally I found the way to put a search bar module in "displayHomeTabContent" and seems that with some CSS it will fit nice. But withe modules in header is other story. I wanted to put a social block on the left of the header logo but can't find the way, it always go to corner upper left if I hook it on displayHeader or down to horizontal menu if I hook it on displayTop. No way to put it between nav bar and horizontal menu. My code is this one: blocksocial.php public function install() { return (parent::install() AND Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', '') && Configuration::updateValue('BLOCKSOCIAL_TWITTER', '') && Configuration::updateValue('BLOCKSOCIAL_RSS', '') && Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', '') && Configuration::updateValue('BLOCKSOCIAL_GOOGLE_PLUS', '') && Configuration::updateValue('BLOCKSOCIAL_PINTEREST', '') && Configuration::updateValue('BLOCKSOCIAL_VIMEO', '') && $this->registerHook('displayHeader') && $this->registerHook('displayTop') && $this->registerHook('displayFooter')); } public function getContent() { // If we try to update the settings $output = ''; if (Tools::isSubmit('submitModule')) { Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', Tools::getValue('blocksocial_facebook', '')); Configuration::updateValue('BLOCKSOCIAL_TWITTER', Tools::getValue('blocksocial_twitter', '')); Configuration::updateValue('BLOCKSOCIAL_RSS', Tools::getValue('blocksocial_rss', '')); Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', Tools::getValue('blocksocial_youtube', '')); Configuration::updateValue('BLOCKSOCIAL_GOOGLE_PLUS', Tools::getValue('blocksocial_google_plus', '')); Configuration::updateValue('BLOCKSOCIAL_PINTEREST', Tools::getValue('blocksocial_pinterest', '')); Configuration::updateValue('BLOCKSOCIAL_VIMEO', Tools::getValue('blocksocial_vimeo', '')); $this->_clearCache('blocksocial.tpl'); Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&tab_module='.$this->tab.'&conf=4&module_name='.$this->name); } return $output.$this->renderForm(); } public function hookDisplayHeader() { $this->context->controller->addCSS(($this->_path).'blocksocial.css', 'all'); if (!$this->isCached('blocksocial_header.tpl', $this->getCacheId())) $this->smarty->assign(array( 'facebook_url' => Configuration::get('BLOCKSOCIAL_FACEBOOK'), 'twitter_url' => Configuration::get('BLOCKSOCIAL_TWITTER'), 'rss_url' => Configuration::get('BLOCKSOCIAL_RSS'), 'youtube_url' => Configuration::get('BLOCKSOCIAL_YOUTUBE'), 'google_plus_url' => Configuration::get('BLOCKSOCIAL_GOOGLE_PLUS'), 'pinterest_url' => Configuration::get('BLOCKSOCIAL_PINTEREST'), 'vimeo_url' => Configuration::get('BLOCKSOCIAL_VIMEO'), )); return $this->display(__FILE__, 'blocksocial_header.tpl', $this->getCacheId()); } blocksocial_header.tpl <div id="social_block_header"> <ul> {if $facebook_url != ''}<li class="facebook"><a class="_blank" href="{$facebook_url|escape:html:'UTF-8'}">{l s='Facebook' mod='blocksocial'}</a></li>{/if} {if $twitter_url != ''}<li class="twitter"><a class="_blank" href="{$twitter_url|escape:html:'UTF-8'}">{l s='Twitter' mod='blocksocial'}</a></li>{/if} {if $rss_url != ''}<li class="rss"><a class="_blank" href="{$rss_url|escape:html:'UTF-8'}">{l s='RSS' mod='blocksocial'}</a></li>{/if} {if $youtube_url != ''}<li class="youtube"><a class="_blank" href="{$youtube_url|escape:html:'UTF-8'}">{l s='YouTube' mod='blocksocial'}</a></li>{/if} {if $google_plus_url != ''}<li class="google_plus"><a class="_blank" href="{$google_plus_url|escape:html:'UTF-8'}">{l s='Google+' mod='blocksocial'}</a></li>{/if} {if $pinterest_url != ''}<li class="pinterest"><a class="_blank" href="{$pinterest_url|escape:html:'UTF-8'}">{l s='Pinterest' mod='blocksocial'}</a></li>{/if} {if $vimeo_url != ''}<li class="vimeo"><a href="{$vimeo_url|escape:html:'UTF-8'}">{l s='Vimeo' mod='blocksocial'}</a></li>{/if} </ul> </div> And then I have this simple CSS tag in global.css but I tried lot of things to put it next to header logo with no success: #social_block_header { width: 33%; padding: 6px 15px 0 15px; } Thanks for any advice. P.D.: Sorry, page url is this one http://lamallorquina.onesixstudio.com/es/
  22. Thanks to the welcome. Of course I have backup my blocksearch.php and I can go back to previous search block state with no problem but it still don't know how to take out the Search Block from header or top hooks without loosing its style in "displayHomeTapContent" :/ It seems I should find the hookRightColumn or hookTop functions and copy it code in my modified blocksearch.php?
  23. Hey thanks! I'm making dome progress, here's what I tried: Opened blocksearch.php and added changed this content related to "displayHomeTab" public function install() { if (!parent::install() || !$this->registerHook('top') || !$this->registerHook('header') || !$this->registerHook('displayHomeTabContent') || !$this->registerHook('displayMobileTopSiteMap')) return false; return true; } public function hookdisplayHomeTabContent($params) { return $this->hookTop($params); } An then I added the hook in Prestashops dashboard Modules/Position/Add a new hook. And it worked! Think I shoud change some CSS cause now is sticked with featured products but it seems correct enough ^^ The problem now is that I want to remove de one Search Block in Header and I tried to remove it's hook in header and here's the issue (in image attached). The block didn't disapear, it keeps showing in header and it losts it's style in both hooks (header and displayHomeTapContent)
  24. Hi I've been seeing that lot of my problems setting up my page (using PS 1.6.0.7 and default-bootstrap template) is that there are some modules that don't hook in some determinated places. For example: I wanted to hook Social buttons block to "displayHeader", next to logo but it says that this block can't be placed there. Or I wanted to place Rapid search block to to "displayHomeTab" next to New Products and Featured Products buttons but it says it is not possible. I know I could add this blocks in some other places and modify their margins with CSS but I'm afraid I'll break the responsive patterns of the template. Are there alternatives to place this blocks... ummm... hard coding? Openning some .TLP and then ok, here call this block? Thanks for any suggestions ^^
×
×
  • Create New...

Important Information

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