-
Posts
96 -
Joined
-
Last visited
Profile Information
-
Activity
Developer
defuzed's Achievements
-
Changing The Number Of products Shown Per Row
defuzed replied to Basement1995's topic in Core developers
Ok, like i said in previous posts don't just mess with classes in global.css, unless you are sure they only affect one specific element. The changes you desire are fairly straightforward with a little understanding of the bootstrap grid system and how prestashop applies it. I'll walk you through it: 1. The bootstrap grid doesn't provide a 5 item column, so you will have to add that functionality yourself. I already provided this code in an above post but for completeness sakes i'll post it again .col-xs-15, .col-sm-15, .col-md-15, .col-lg-15 { position: relative; min-height: 1px; padding-right: 10px; padding-left: 10px; } .col-xs-15 { width: 20%; float: left; } @media (min-width: 768px) { .col-sm-15 { width: 20%; float: left; } } @media (min-width: 992px) { .col-md-15 { width: 20%; float: left; } } @media (min-width: 1200px) { .col-lg-15 { width: 20%; float: left; } } (original source iirc is : http://www.wearesicc.com/quick-tips-5-column-layout-with-twitter-bootstrap/ ) add this at the end of your global.css. 2. Now you just have to play around a little with product-list.tpl. {if isset($products) && $products} {*define number of products per line in other page for desktop*} {if $page_name !='index' && $page_name !='product'} {* this is category page *} {assign var='nbItemsPerLine' value=4} {* was 3 *} {assign var='nbItemsPerLineTablet' value=2} {assign var='nbItemsPerLineMobile' value=3} {else} {assign var='nbItemsPerLine' value=5} {* was 4 *} {assign var='nbItemsPerLineTablet' value=3} {assign var='nbItemsPerLineMobile' value=2} {/if} {*define numbers of product per line in other page for tablet*} {assign var='nbLi' value=$products|@count} {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines} {math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet} <!-- Products list --> <ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/if}"> {foreach from=$products item=product name=products} {math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo} {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet} {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile} {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if} {if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if} {if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if} <li class="ajax_block_product{if $page_name == 'index'} col-xs-12 col-sm-4 col-md-15{else if $page_name == 'product'} col-xs-12 col-sm-4 col-md-3{else} col-xs-12 col-sm-6 col-md-3{/if} {* cut off here since the rest stays the same - This is where you change the bootstrap grid classes so for index change to col-md-15 (5 columns) and category change to col-md-3 (4 columns)*} that should work, good luck -
Changing The Number Of products Shown Per Row
defuzed replied to Basement1995's topic in Core developers
hm are you using some kind of theme? I don't recall some sort of scrolling option being a prestashop default but i could be mistaken, anyway i can't help you with them not being there and nothing in the source indicating the presence of the scroll buttons... I think the best way would be if you just revert everything to the way it was, then tell me what you want to achieve and i'll have a look at that. In the current state it's just too much guessing... *edit* also, if you are using a theme, please attach the relevant templates (product-list.tpl etc.) as attachments since they will probably be modified -
Changing The Number Of products Shown Per Row
defuzed replied to Basement1995's topic in Core developers
The link you provided isn't working, it'S gonna be hard to help you without being able to inspect the actual page... As a side note you should NOT change width settings of "col-md-" classes, i can't really tell what you are trying to do since global.css: 854 ...col-md-4 { width: 23.33333%; } changed to 23.3333% doesn't really make sense, but judding from the next "changed to 20%" if you need bootstrap columns to fit 5 elements you will have to add the following to global.css .col-xs-15, .col-sm-15, .col-md-15, .col-lg-15 { position: relative; min-height: 1px; padding-right: 10px; padding-left: 10px; } .col-xs-15 { width: 20%; float: left; } @media (min-width: 768px) { .col-sm-15 { width: 20%; float: left; } } @media (min-width: 992px) { .col-md-15 { width: 20%; float: left; } } @media (min-width: 1200px) { .col-lg-15 { width: 20%; float: left; } } and then use the col-md-15 class in you templates. Anyway please provide a working link. -
I'm not asking to follow some fads but best-practices that have become industry standards and are widely being used AND advocated*. JSHint / JSLint provide simple and customizeable tools that help follow these best-practices and are trivial to use. Files like 'order-address.js', where even lax configurations of jshint display over 30 errors on ~220 lines of code - stuff ranging from more or less trivial "no brackets around if statements" to undefined variables and using "==". This not only makes for poor readability but can also lead to stuff just breaking when using anything other than the default presta config / modules etc. These coding standards are there exactly for these reasons. You obviously cannot test prestashop for every configuration that users and developers will throw at it. Using these best practices not only prevents a multitude of bugs, compatibility errors, it can also increase performance and increases productivity by making more experienced developers happy and encouraging proper coding standards for novice developers / amateurs. * AirBnBs Javascript Styleguide Idiomatic.js Google Javascript Styleguide (older but also relevant) Crockfords Code Conventions (also old but relevant) ...
-
Javascript coding style from prestashop is godawful... Please please make this one your priorities for future versions. Use something like jshint and/or read up on proper javascript coding practices. /endrant
-
What is wrong in the sencence {$address_delivery->postcode}" ?
defuzed replied to josias's topic in Core developers
try {$address_collection[$id_address]->postcode} $address_delivery is not defined in order_carrier.tpl so you need to get the postcode from $address_collection -
Debug Profiling not working in prestashop 1.5.4
defuzed replied to quietkillah's topic in Core developers
Plunckers answer did the trick on 1.5.5, thanks Pluncker -
Overrides will not get overwritten when you upgrade
-
loading the fancybox files through a controller override is the best way yes! But you only need some of those files you are including, just do: <?php class CmsController extends CmsControllerCore { public function setMedia() { parent::setMedia(); Tools::addCSS(_PS_CSS_DIR_.'jquery.fancybox.css', 'screen'); Tools::addJS(_PS_JS_DIR_.'js/jquery/plugins/jquery.fancybox.js'); } } you will also need to call fancybox for the appropriate element as prestashow.eu said. I don't think you're allowed to place <script> tags through the cms WYSIWYG so just paste the line from prestashow.eu at the bottom of the cms.tpl
-
It is hard to actually help without clear wishes of what you are trying to accomplish. Do you want a category page to look exactly like what you posted? Are you willing/able to edit them templates and css files? As a side note: I think the example you linked looks extremely outdated and the lack of proper typography/alignment also makes it quite chaotic.
-
nono, it's quite possible there is no window.load function in your product.js , just try adding the block i posted as is at the end of the product.js. All the $(window).load function does is execute whatever is in it AFTER everything lese in the page has been loaded. So what this does in your case is wait until everything else on the page has been loaded (for instance adding "selected" class to the default color) and then get that color's name to place into your text element.
-
I agree the random letters that are prestashop's default order number are terrible for customer communication. We use this module https://www.prestashop.com/forums/topic/218257-module-change-order-reference-using-order-id-andor-cart-id/ that way you can change the order reference directly and the invoice will be changed accordingly
-
hm ok, probably the selected class is being changed after the text of "selectedCmb" is set. Try putting the line i posted above in $(window).load(function() { $("#selectedCmb").text($('.color_pick.selected').attr('name')); });
-
I don't use color pciker so i didn't test this, but it would seem to me that you just have to add $("#selectedCmb").text($('.color_pick.selected').attr('name')); to the $(document).ready function in product.js
-
Well the attachment IDs are actually given by order of upload (if i correctly understood what you mean by "order of upload"), in the sense that if i upload attachment a first, it will get ID=1 and then upload attachment b, it will get ID=2. Maybe the "first attachment" you are trying to show guests also has a specific mime type that the other attachmennts don't have? If so you could {if $attachment.mime == "application/pdf"} or whatever mime type would be correct. Or, even simpler, add a specific word to the extension name you're trying to show everyone then you could {if $attachment.name|strstr:"[sPECIFIC_WORD]"}