-
Posts
11 -
Joined
-
Last visited
Profile Information
-
Location
Cluj-Napoca
-
Activity
Developer
-iD-'s Achievements
Newbie (1/14)
4
Reputation
-
[SOLVED] Add quantity box to product listing
-iD- replied to ramar's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
themes/_YOUR_THEME_/product-list.tpl round line 155 inside .button-container <p class="quantity_wanted_p"> <input type="text" readonly name="quantity_to_cart_{$product.id_product|intval}" id="quantity_to_cart_{$product.id_product|intval}" class="text" value="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}" /> <a href="#" data-field-qty="quantity_to_cart_{$product.id_product|intval}" class="btn btn-default button-minus product_quantity_down"> <span><i class="icon-minus"></i></span> </a> <a href="#" data-field-qty="quantity_to_cart_{$product.id_product|intval}" class="btn btn-default button-plus product_quantity_up"> <span><i class="icon-plus"></i></span> </a> <span class="clearfix"></span> </p> themes/_YOUR_THEME_/js/global.js round line 26 after var responsiveflag = false; // The button to increment the product value $(document).on('click', '.product_list .product_quantity_up', function(e){ e.preventDefault(); fieldName = $(this).data('field-qty'); var currentVal = parseInt($('input[name='+fieldName+']').val()); var minimalVal = parseInt($('input[name='+fieldName+']').attr("data-minimal_quantity")); if (!isNaN(currentVal) && currentVal < minimalVal) { $('input[name='+fieldName+']').val(minimalVal); $(this).parent().parent().find(".ajax_add_to_cart_button").attr("data-minimal_quantity",minimalVal); } else { $('input[name='+fieldName+']').val(currentVal + 1).trigger('keyup'); $(this).parent().parent().find(".ajax_add_to_cart_button").attr("data-minimal_quantity",currentVal + 1); } $('#'+fieldName).change(); }); // The button to decrement the product value $(document).on('click', '.product_list .product_quantity_down', function(e){ e.preventDefault(); fieldName = $(this).data('field-qty'); var currentVal = parseInt($('input[name='+fieldName+']').val()); var minimalVal = parseInt($('input[name='+fieldName+']').attr("data-minimal_quantity")); if (!isNaN(currentVal) && currentVal > minimalVal){ $('input[name='+fieldName+']').val(currentVal - 1).trigger('keyup'); $(this).parent().parent().find(".ajax_add_to_cart_button").attr("data-minimal_quantity",currentVal - 1); } else { $('input[name='+fieldName+']').val(minimalVal); $(this).parent().parent().find(".ajax_add_to_cart_button").attr("data-minimal_quantity",minimalVal); } $('#'+fieldName).change(); }); themes/_YOUR_THEME_/js/modules/blockcart/ajax-cart.js line 135 replace this var minimalQuantity = parseInt($(this).data('minimal_quantity')); with this var minimalQuantity = parseInt($(this).attr('data-minimal_quantity')); Result : -
[Solved] Deleting test orders
-iD- replied to debugginglife's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
The best way to do this, is to create an override for controllers/admin/AdminOrdersController.php. Create a AdminOrdersController.php file in override/controllers/admin/ with this code : class AdminOrdersController extends AdminOrdersControllerCore { public function __construct() { parent::__construct(); $this->addRowAction('delete'); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); } } Clear your store cache, or simply delete class_index.php which is in /cache/ folder. In admin it will apear "Delete" button inside dropdown button action in orders page Or you can check multiple orders and delete them at once. -
blocklayered min_price missing vat
-iD- replied to hannhimhe's topic in Configuring and using PrestaShop
Prestashop 1.6.0.1 - multishop This change is for prices including tax My problem was like this : - I have product list with price including tax - filtering price : with the range set between 2,00 € - 15.60 € , and I was having some products with price 19 €. - even if I was having "Use tax to filter price" set ON in blocklayered configuration So what I did is to add 2 conditions in WHERE statement for $this->products inside function getProductByFilters in \modules\blocklayred\blocklayred.php Around line 220 turn this : if (version_compare(_PS_VERSION_, '1.6.1', '>=') === true) { $this->products = Db::getInstance()->executeS(' SELECT p.*, '.($alias_where == 'p' ? '' : 'product_shop.*,' ).' '.$alias_where.'.id_category_default, pl.*, image_shop.`id_image` id_image, il.legend, m.name manufacturer_name, '.(Combination::isFeatureActive() ? 'product_attribute_shop.id_product_attribute id_product_attribute,' : '').' DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '').' FROM '._DB_PREFIX_.'cat_filter_restriction cp LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` '.Shop::addSqlAssociation('product', 'p'). (Combination::isFeatureActive() ? ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').' LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.') LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$cookie->id_lang.') LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer) '.Product::sqlStock('p', 0).' WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).' , cp.id_product'. ' LIMIT '.(((int)$this->page - 1) * $n.','.$n), true, false); } else { $this->products = Db::getInstance()->executeS(' SELECT p.*, '.($alias_where == 'p' ? '' : 'product_shop.*,' ).' '.$alias_where.'.id_category_default, pl.*, MAX(image_shop.`id_image`) id_image, il.legend, m.name manufacturer_name, '.(Combination::isFeatureActive() ? 'MAX(product_attribute_shop.id_product_attribute) id_product_attribute,' : '').' DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', MAX(product_attribute_shop.minimal_quantity) AS product_attribute_minimal_quantity' : '').' FROM '._DB_PREFIX_.'cat_filter_restriction cp LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` '.Shop::addSqlAssociation('product', 'p'). (Combination::isFeatureActive() ? '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 AND product_attribute_shop.id_shop='.(int)$context->shop->id):'').' LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.') 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)$cookie->id_lang.') LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer) '.Product::sqlStock('p', 0).' WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") GROUP BY product_shop.id_product ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).' , cp.id_product'. ' LIMIT '.(((int)$this->page - 1) * $n.','.$n), true, false); } into this if (version_compare(_PS_VERSION_, '1.6.1', '>=') === true) { $this->products = Db::getInstance()->executeS(' SELECT p.*, '.($alias_where == 'p' ? '' : 'product_shop.*,' ).' '.$alias_where.'.id_category_default, pl.*, image_shop.`id_image` id_image, il.legend, m.name manufacturer_name, '.(Combination::isFeatureActive() ? 'product_attribute_shop.id_product_attribute id_product_attribute,' : '').' DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '').' FROM '._DB_PREFIX_.'cat_filter_restriction cp LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` '.Shop::addSqlAssociation('product', 'p'). (Combination::isFeatureActive() ? ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').' LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.') LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$cookie->id_lang.') LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer) '.Product::sqlStock('p', 0).' WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") '.(isset($price_filter['max'])?' AND ('.$alias_where.'.`price` * ((100 +(SELECT max(t.rate) max_rate FROM `'._DB_PREFIX_.'product_shop` pcustom LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg ON (trg.id_tax_rules_group = pcustom.id_tax_rules_group AND pcustom.id_shop = '.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.id_tax_rules_group = trg.id_tax_rules_group) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.id_tax = tr.id_tax AND t.active = 1) WHERE pcustom.id_product = product_shop.id_product GROUP BY pcustom.id_product))/100)) <= '.$price_filter['max'].' ':'').' '.(isset($price_filter['min'])?' AND ('.$alias_where.'.`price` * ((100 + (SELECT max(t.rate) max_rate FROM `'._DB_PREFIX_.'product_shop` pcustom LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg ON (trg.id_tax_rules_group = pcustom.id_tax_rules_group AND pcustom.id_shop = '.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.id_tax_rules_group = trg.id_tax_rules_group) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.id_tax = tr.id_tax AND t.active = 1) WHERE pcustom.id_product = product_shop.id_product GROUP BY pcustom.id_product)) / 100) ) >= '.$price_filter['min'].' ':'').' ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).' , cp.id_product'. ' LIMIT '.(((int)$this->page - 1) * $n.','.$n), true, false); } else { $this->products = Db::getInstance()->executeS(' SELECT p.*, '.($alias_where == 'p' ? '' : 'product_shop.*,' ).' '.$alias_where.'.id_category_default, pl.*, MAX(image_shop.`id_image`) id_image, il.legend, m.name manufacturer_name, '.(Combination::isFeatureActive() ? 'MAX(product_attribute_shop.id_product_attribute) id_product_attribute,' : '').' DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', MAX(product_attribute_shop.minimal_quantity) AS product_attribute_minimal_quantity' : '').' FROM '._DB_PREFIX_.'cat_filter_restriction cp LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` '.Shop::addSqlAssociation('product', 'p'). (Combination::isFeatureActive() ? '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 AND product_attribute_shop.id_shop='.(int)$context->shop->id):'').' LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.') 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)$cookie->id_lang.') LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer) '.Product::sqlStock('p', 0).' WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") '.(isset($price_filter['max'])?' AND ('.$alias_where.'.`price` * ((100 +(SELECT max(t.rate) max_rate FROM `'._DB_PREFIX_.'product_shop` pcustom LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg ON (trg.id_tax_rules_group = pcustom.id_tax_rules_group AND pcustom.id_shop = '.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.id_tax_rules_group = trg.id_tax_rules_group) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.id_tax = tr.id_tax AND t.active = 1) WHERE pcustom.id_product = product_shop.id_product GROUP BY pcustom.id_product))/100)) <= '.$price_filter['max'].' ':'').' '.(isset($price_filter['min'])?' AND ('.$alias_where.'.`price` * ((100 + (SELECT max(t.rate) max_rate FROM `'._DB_PREFIX_.'product_shop` pcustom LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg ON (trg.id_tax_rules_group = pcustom.id_tax_rules_group AND pcustom.id_shop = '.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.id_tax_rules_group = trg.id_tax_rules_group) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.id_tax = tr.id_tax AND t.active = 1) WHERE pcustom.id_product = product_shop.id_product GROUP BY pcustom.id_product)) / 100) ) >= '.$price_filter['min'].' ':'').' GROUP BY product_shop.id_product ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).' , cp.id_product'. ' LIMIT '.(((int)$this->page - 1) * $n.','.$n), true, false); } So the conditions force my result to get only those products where their prices includes tax and their prices are between my interval. Conditions : '.(isset($price_filter['max'])?' AND ('.$alias_where.'.`price` * ((100 +(SELECT max(t.rate) max_rate FROM `'._DB_PREFIX_.'product_shop` pcustom LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg ON (trg.id_tax_rules_group = pcustom.id_tax_rules_group AND pcustom.id_shop = '.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.id_tax_rules_group = trg.id_tax_rules_group) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.id_tax = tr.id_tax AND t.active = 1) WHERE pcustom.id_product = product_shop.id_product GROUP BY pcustom.id_product))/100)) <= '.$price_filter['max'].' ':'').' '.(isset($price_filter['min'])?' AND ('.$alias_where.'.`price` * ((100 + (SELECT max(t.rate) max_rate FROM `'._DB_PREFIX_.'product_shop` pcustom LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg ON (trg.id_tax_rules_group = pcustom.id_tax_rules_group AND pcustom.id_shop = '.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.id_tax_rules_group = trg.id_tax_rules_group) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.id_tax = tr.id_tax AND t.active = 1) WHERE pcustom.id_product = product_shop.id_product GROUP BY pcustom.id_product)) / 100) ) >= '.$price_filter['min'].' ':'').' Hope it helps you guys. -
Order status update Error on pre upgrade orders
-iD- replied to e5m1r's topic in Configuring and using PrestaShop
Great ! Thanks ! Helped me a lot ! -
[RESOLU] page suivante et precedente dans la page produit
-iD- replied to ultraxa's topic in PrestaShop pour les développeurs
Merci ! Works on 1.6.0.9 -
One page checkout registration errors
-iD- replied to Frank van der Voort's topic in Configuring and using PrestaShop
After a code review I found the error. So it's not prestashops fault, it's ours. In order-opc-new-account.tpl div with "#opc_account_form" id has it's tag end "</div>" early in the code before 2-3 fields. So i put it before the "</fieldset>" and now works pefcetly. My bad, sorry, and thanks for your support. -
One page checkout registration errors
-iD- replied to Frank van der Voort's topic in Configuring and using PrestaShop
Errors for required values in registration input fields, even if they are filled. -
One page checkout registration errors
-iD- replied to Frank van der Voort's topic in Configuring and using PrestaShop
I'm also have several errors in one page checkout in registration process (ps 1.5). Does anyone have a solution for this ? -
Mobile Site in 1.5.2.0 Doesn't Show Subcategories
-iD- replied to deepee's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
Checkout process works on mobile version in prestashop 1.5.3 And i have the same problem with displaying the subcategories. Any suggestions ?