Jump to content

derthis

Members
  • Posts

    30
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

derthis's Achievements

Newbie

Newbie (1/14)

3

Reputation

  1. Found this topic: http://www.prestashop.com/forums/topic/136126-auto-versioning-css-files-force-css-refresh/ Well, it seems to be as easy as adding a file in override/classes called Tools.php with this content: <?php class Tools extends ToolsCore { //credit: http://particletree....vascript-files/ public static function autoVer($url){ $path = pathinfo($url); if(file_exists($_SERVER['DOCUMENT_ROOT'].$url)) $ver = filemtime($_SERVER['DOCUMENT_ROOT'].$url); else $ver = '1'; return $path['dirname'].'/'.$path['basename'].'?v='.$ver; } public static function addCSS($css_uri, $css_media_type = 'all') { global $css_files; if (is_array($css_uri)) { foreach ($css_uri as $file => $media_type) self::addCSS($file, $media_type); return true; } //overriding of modules css files $different = 0; $override_path = str_replace(__PS_BASE_URI__.'modules/', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different); if ($different && file_exists($override_path)) $css_uri = str_replace(__PS_BASE_URI__.'modules/', __PS_BASE_URI__.'themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different); else { // remove PS_BASE_URI on _PS_ROOT_DIR_ for the following $url_data = parse_url($css_uri); $file_uri = _PS_ROOT_DIR_.self::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']); // check if css files exists if (!file_exists($file_uri)) return true; } // detect mass add $css_uri = array(Tools::autoVer($css_uri) => $css_media_type);//This is the only line that has been changed to add in the call to the new autoVer function we created above. // adding file to the big array... if (is_array($css_files)) $css_files = array_merge($css_files, $css_uri); else $css_files = $css_uri; return true; } } ?> Now CSS has version in it and it should force the browser to download it every time.
  2. Just what I was looking for - I added the override and it seems to work just fine. Thanks, I will re-post this into my own topic where I asked for such a solution, so others may find it too . Thanks!
  3. In other word - HTML template files are reloaded, but CSS files are old. Nobody solved this before?
  4. Hi, I have developed a website in PrestaShop, now I am in a process of redesigning it, and I am thining about how to deploy this new design to a already in-production site. The problem is when I deploy even a little change, I turn off smarty cache, I turn on compile_check=on, disable all CCC and CC.. Even then when I open the website, there is an old version of it, cached in my browser. I can see all the changes by pressing cmd+R or F5, but - I have to do this reload on every single page type (i.e. homepage, product page, category page, cms page..) and BUT - I fear my clients won't think of pressing cmd+r or F5 (returning ones) - they will just see the broken page design! I really worry about those returning clients who may not be so experienced and may not clean their cache. Therefore I really worry about deploying all those big changes in design. Any ideas how to solve this, e.g. setting expires in headers? how? or will renaming the theme force browser to reload css and js? or something else? Problematic are the CSS (and perhaps JS files). Thanks for your ideas.
  5. Well, the problem is the configuration of blocklayered module. When you have "show products from subcategories" selected, then you have no default sorting option.
  6. Hi, It seems that what you choose in BO -> Preferences -> Product -> Default sorting has no effect whatsoever when you are using blocklayered module. Is there any way to fix this? I would like products in my categories sorted in the same order as they are in BO -> Catalog. Thanks for help.
  7. Silly me. I missed that one last bracket. So, if you want to sort your features by name, you can edit classes/Product.php and on line 2752, there you have to modify this query accordingly: self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT name, value, pf.id_feature FROM '._DB_PREFIX_.'feature_product pf LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.') WHERE pf.id_product = '.(int)$id_product.' ORDER BY name ASC'); The last line is important - it ORDERs BY name. Be aware of the brackets. (btw. overriding doesn't work)
  8. Hi Everyone, I try to sort features on product page, I found out that they are generated by this function: public static function getFrontFeaturesStatic($id_lang, $id_product) { if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache)) { self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance()->ExecuteS(' SELECT name, cat, value, pf.id_feature FROM '._DB_PREFIX_.'feature_product pf LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.') WHERE pf.id_product = '.(int)$id_product); } return self::$_frontFeaturesCache[$id_product.'-'.$id_lang]; } However, if I try to add 'ORDER BY ' clause at the end of the query, it breaks and shows either 'A A' or nothing. Even if I try to add a whitespace after WHERE clause, meaning: WHERE pf.id_product = '.(int)$id_product).' '; It breaks! How is it possible? How to make this query editable? Thanks for your comments.
  9. Found it - I messed with order-detail.tpl and I should have not done that. So if you find yourself in similar situation, you know where to look - in order-detail.tpl. Quite obvious.
  10. If I change theme to basic prestashop theme, it works. Please, what to look for. I made really a lot of small changes all over and narrowing it down a little bit would be really helpful. Thanks.
  11. Hi Everyone, I installed PrestaShop, added modules and configured it a little bit, and when I tried orders and viewing orders in MyAccount section, clicking on "Details" at a order doesn't work. When I open Chrome Console, it says this: GET http://localhost/webs/electroland-dev/order-detail.php?id_order=2&ajax=true 500 (Internal Server Error) jquery-1.4.4.min.js:141 c.extend.ajax jquery-1.4.4.min.js:141 c.extend.get jquery-1.4.4.min.js:133 showOrder history.js:36 (anonymous function) order-history:1 Any ideas what could have gone wrong? Thanks!
  12. It is this line in classes/Search.php in sanitize function $string = preg_replace('/['.PREG_CLASS_SEARCH_EXCLUDE.']+/u', ' ', $string); commenting it out solves the problem. However, I fear it could damage search functionality in other way. If you know why this line is problematic on some servers and how to fix it, I would appreciate it.
  13. OK, I found the problem: It's Search::sanitize function. Doesn't work on Live Server, works on Localhost. It breaks Search::find and Search::indexation. Don't know what could cause this. Any ideas?
  14. I added an array inside classes/Search.php, which I then return as a debug parametr and which I print in smarty {$debug|@print_r}. In this debug array I collect SELECT statements, counts, etc. On localhost, it works fine and it prints out the data.. However, on Live Server, the same code doesn't work and this array is not even empty, but seems not initialized at all. I fear there is some problem with calling Search.php, or its functions respectively. Every other aspect of PrestaShop however works on this exact same server. Server info: PHP: 5.3 MySQL: 5.5
  15. OK, I figured it out. in blocklayered.php on line 2291 change SELECT so that it contains 'pl.available_now': SELECT p.id_product, p.on_sale, p.out_of_stock, p.available_for_order, p.quantity, p.minimal_quantity, p.id_category_default, p.customizable, p.show_price, p.`weight`, p.ean13, pl.available_now, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend, m.name manufacturer_name, p.condition, p.id_manufacturer, DATEDIFF(p.`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 after that, you can use this code in product-list.tpl (provided by Nicklaenen) and you will see availability statuses you have written to each product: {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{$product.available_now}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{$product.available_later}{/if}</span>{/if} Enjoy
×
×
  • Create New...