mmsh Posted December 18, 2015 Share Posted December 18, 2015 (edited) Hello, I tried to do it... latest Prestashop 1.6.1.3 now apart from install autoupgrade module, change permissions here and there, AdminSelfUpgrade.php to edit if you have the mobile_theme installed.... export default theme from a fresh installation, install a random theme and activate, delete the bootstrap theme....reupload it from the backup and reactivate (otherwise is a mess with modules positions...)... and so on... AT THE END: customers and orders are there, customers can login NO manufacturers in front office, just in backoffice the table specific_price is empty I had to export the previous specific_price from the production installation in phpmyadmin with the option CREATE TABLE IF NOT EXISTS and method INSERT.. and discounts are there for single products BUT in front office discounts are hidden tried to replace the query as suggested here https://www.prestashop.com/forums/topic/467748-solved-specific-price-error-after-update-from-1609-to-1611/page-2?do=findComment&comment=2179280 nothing to do... the front office doesn't find any discount What can I do now? Thanks Edited December 18, 2015 by mmsh (see edit history) Link to comment Share on other sites More sharing options...
Simonas Invertus Posted December 18, 2015 Share Posted December 18, 2015 2. Manufacturers in front office might be module or theme. Did you upgraded them? Link to comment Share on other sites More sharing options...
mmsh Posted December 18, 2015 Author Share Posted December 18, 2015 (edited) 2. Manufacturers in front office might be module or theme. Did you upgraded them? yes, all modules are updated Block manufacturers is v1.4.0 by Prestashop that's a problem, but the reductions are worse.... I need to understand where is the error, In PS 1.6 there are also ps_specific_price_rule ps_specific_price_rule_condition ps_specific_price_rule_condition_group do they need any set value in order to show the discounts? Then, my specific_price now is something like: <table name="ps_specific_price"> <column name="id_specific_price">1</column> <column name="id_specific_price_rule">0</column> <column name="id_cart">0</column> <column name="id_product">37986</column> <column name="id_product_attribute">0</column> <column name="id_shop">0</column> <column name="id_shop_group">0</column> <column name="id_currency">0</column> <column name="id_country">0</column> <column name="id_group">0</column> <column name="id_customer">0</column> <column name="price">14.514000</column> <column name="from_quantity">1</column> <column name="reduction">0.050407</column> <column name="reduction_tax">1</column> <column name="reduction_type">percentage</column> <column name="from">0000-00-00 00:00:00</column> <column name="to">0000-00-00 00:00:00</column> </table> maybe something wrong there? Thanks Edited December 18, 2015 by mmsh (see edit history) Link to comment Share on other sites More sharing options...
mmsh Posted December 18, 2015 Author Share Posted December 18, 2015 (edited) The query now is: $now = date('Y-m-d H:i:00'); $query = ' SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).' FROM `'._DB_PREFIX_.'specific_price` USE INDEX (id_product_2) WHERE `id_product` IN (0, '.(int)$id_product.') AND `id_product_attribute` IN (0, '.(int)$id_product_attribute.') AND `id_shop` IN (0, '.(int)$id_shop.') AND `id_currency` IN (0, '.(int)$id_currency.') AND `id_country` IN (0, '.(int)$id_country.') AND `id_group` IN (0, '.(int)$id_group.') AND `id_customer` IN (0, '.(int)$id_customer.') AND ( (`from` = \'0000-00-00 00:00:00\' OR \''.$now.'\' >= `from`) AND (`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`) ) AND id_cart IN (0, '.(int)$id_cart.') AND IF(`from_quantity` > 1, `from_quantity`, 0) <= '; don't you think it should work? is there anything wrong in other php file? compared the two tables, from the upgraded (with imported specific_price) and the one from a fresh installation... it doesn't seem that there are different values...! Edited December 18, 2015 by mmsh (see edit history) Link to comment Share on other sites More sharing options...
Simonas Invertus Posted December 18, 2015 Share Posted December 18, 2015 I can't understand: 1) specific prices are missing at all? In this case maybe you forgot to move some tables. 2) specific prices are ok in BackOffice, bad in Front office? In this case maybe the problem is with template not with sql Table looks okay. PHP I am not sure, which file did you find this function? Link to comment Share on other sites More sharing options...
mmsh Posted December 19, 2015 Author Share Posted December 19, 2015 I'm using the default bootstrap theme... so the error is in the theme? I don't think that... prices-drop.tpl just has {if $products}... it means that $products is not set 'cause Product::getPricesDrop doesn't get the discounts.. any dev here? Link to comment Share on other sites More sharing options...
mmsh Posted December 19, 2015 Author Share Posted December 19, 2015 (edited) This is the current getPricesDrop ... here sublime text doesn't highlight the first and the last bracket and I don't know why... public static function getPricesDrop($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, $beginning = false, $ending = false, Context $context = null) { if (!Validate::isBool($count)) { die(Tools::displayError()); } if (!$context) { $context = Context::getContext(); } if ($page_number < 0) { $page_number = 0; } if ($nb_products < 1) { $nb_products = 10; } if (empty($order_by) || $order_by == 'position') { $order_by = 'price'; } if (empty($order_way)) { $order_way = 'DESC'; } if ($order_by == 'id_product' || $order_by == 'price' || $order_by == 'date_add' || $order_by == 'date_upd') { $order_by_prefix = 'product_shop'; } elseif ($order_by == 'name') { $order_by_prefix = 'pl'; } if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)) { die(Tools::displayError()); } $current_date = date('Y-m-d H:i:00'); $ids_product = Product::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context); $tab_id_product = array(); foreach ($ids_product as $product) { if (is_array($product)) { $tab_id_product[] = (int)$product['id_product']; } else { $tab_id_product[] = (int)$product; } } $front = true; if (!in_array($context->controller->controller_type, array('front', 'modulefront'))) { $front = false; } $sql_groups = ''; if (Group::isFeatureActive()) { $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = ' AND EXISTS(SELECT 1 FROM `'._DB_PREFIX_.'category_product` cp JOIN `'._DB_PREFIX_.'category_group` cg ON (cp.id_category = cg.id_category AND cg.`id_group` '.(count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1').') WHERE cp.`id_product` = p.`id_product`)'; } if ($count) { return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT COUNT(DISTINCT p.`id_product`) FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p').' WHERE product_shop.`active` = 1 AND product_shop.`show_price` = 1 '.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').' '.((!$beginning && !$ending) ? 'AND p.`id_product` IN('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')' : '').' '.$sql_groups); } if (strpos($order_by, '.') > 0) { $order_by = explode('.', $order_by); $order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`'; } $sql = ' SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`available_now`, pl.`available_later`, IFNULL(product_attribute_shop.id_product_attribute, 0) id_product_attribute, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, m.`name` AS manufacturer_name, DATEDIFF( p.`date_add`, DATE_SUB( "'.date('Y-m-d').' 00:00:00", INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY ) ) > 0 AS new FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p').' 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.') '.Product::sqlStock('p', 0, false, $context->shop).' 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_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)$id_lang.') LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) WHERE product_shop.`active` = 1 AND product_shop.`show_price` = 1 '.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').' '.((!$beginning && !$ending) ? ' AND p.`id_product` IN ('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')' : '').' '.$sql_groups.' ORDER BY '.(isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').pSQL($order_by).' '.pSQL($order_way).' LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); if (!$result) { return false; } if ($order_by == 'price') { Tools::orderbyPrice($result, $order_way); } return Product::getProductsProperties($id_lang, $result); } what's wrong there? maybe related to the manufacturers issue ? a difference with the upgraded ps_manufacturers is that on the previous table date_add and date_upd are 0000-00-00 00:00:00 while on the fresh install the dates are set... is there an issue or is unrelated? Edited December 19, 2015 by mmsh (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now