Jump to content

[solved]top sellers are not displaying


Recommended Posts

I think this is problem from your custome theme, like @PascalVG say, try this firstly with the default theme and see what happen.

 

ok i will check soon. i have to do migration process right now.i will share with you about the news.

Link to comment
Share on other sites

Hi ps3z,

Do you have the same problem, when changing to the default theme?

What Prestashop version do you use? Is your theme721 up to date?

Are there any source code-changes made to your PrestaShop?

 

pascal

 

Hi Pascal my presta is 1.5.4.1, i think its happend after upgrading from 1.5.3.1

Link to comment
Share on other sites

The theme that youre using is the same before the upgrade ?, most of theme use on blockfeatured modified, take a look if is the default module or one modified, if this yes, then try with the default.

 

 

i moved to Vps lastnight because of that,i couldnt check well. i checked now.

 

 

Default theme  also have this same problem.i got an error in debug mode.please check at below

 

 

http://screencast.com/t/cHy3EFlR

Edited by ps3z (see edit history)
Link to comment
Share on other sites

Just like a comment, why don't upgrade to 1.5.6.0 ?, ps 1.5.4.1 have some important bugs and maybe you will have more in the further, try to upgrade, if the problem persist I can help you to solve but I don't think so that happen.

Link to comment
Share on other sites

Just like a comment, why don't upgrade to 1.5.6.0 ?, ps 1.5.4.1 have some important bugs and maybe you will have more in the further, try to upgrade, if the problem persist I can help you to solve but I don't think so that happen.

 

my some modules not compatible with 1.5.6

Link to comment
Share on other sites

Hi ps3z,

 

can you try something for me?

1) Backup file classes/ProductSale.php

2) Edit the file, and find the function : public static function getBestSales(...)

3) scroll down until you see:
 
				GROUP BY product_shop.id_product
				ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'
				LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;

then do this:

 

GROUP BY product_shop.id_product
ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'                    <- take this line out
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
 
Why I try this:

The error message  you gave us complains about an ambiguous field date_add (as there is a field date_add in both ps_product and ps_product_shop ). This field is used for ordering the list, therefore if we take out the order by clause from the SQL query, this may 'solve' it.

 

We may need to fix it differently when this indeed solves the problem of not showing the products. We may just have to add the p.date_add in the order field to really fix it correctly.

 

But let's first see if this solves the initial problem.

 

pascal.

Link to comment
Share on other sites

Looks like a problem with your producst table, check if your table have all of this columns:

  `id_product` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_supplier` int(10) unsigned DEFAULT NULL,
  `id_manufacturer` int(10) unsigned DEFAULT NULL,
  `id_category_default` int(10) unsigned DEFAULT NULL,
  `id_shop_default` int(10) unsigned NOT NULL DEFAULT '1',
  `id_tax_rules_group` int(11) unsigned NOT NULL,
  `on_sale` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `online_only` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ean13` varchar(13) DEFAULT NULL,
  `upc` varchar(12) DEFAULT NULL,
  `ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000',
  `quantity` int(10) NOT NULL DEFAULT '0',
  `minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
  `price` decimal(20,6) NOT NULL DEFAULT '0.000000',
  `wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000',
  `unity` varchar(255) DEFAULT NULL,
  `unit_price_ratio` decimal(20,6) NOT NULL DEFAULT '0.000000',
  `additional_shipping_cost` decimal(20,2) NOT NULL DEFAULT '0.00',
  `reference` varchar(32) DEFAULT NULL,
  `supplier_reference` varchar(32) DEFAULT NULL,
  `location` varchar(64) DEFAULT NULL,
  `width` decimal(20,6) NOT NULL DEFAULT '0.000000',
  `height` decimal(20,6) NOT NULL DEFAULT '0.000000',
  `depth` decimal(20,6) NOT NULL DEFAULT '0.000000',
  `weight` decimal(20,6) NOT NULL DEFAULT '0.000000',
  `out_of_stock` int(10) unsigned NOT NULL DEFAULT '2',
  `quantity_discount` tinyint(1) DEFAULT '0',
  `customizable` tinyint(2) NOT NULL DEFAULT '0',
  `uploadable_files` tinyint(4) NOT NULL DEFAULT '0',
  `text_fields` tinyint(4) NOT NULL DEFAULT '0',
  `active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `redirect_type` enum('','404','301','302') NOT NULL DEFAULT '',
  `id_product_redirected` int(10) unsigned NOT NULL DEFAULT '0',
  `available_for_order` tinyint(1) NOT NULL DEFAULT '1',
  `available_date` date NOT NULL,
  `condition` enum('new','used','refurbished') NOT NULL DEFAULT 'new',
  `show_price` tinyint(1) NOT NULL DEFAULT '1',
  `indexed` tinyint(1) NOT NULL DEFAULT '0',
  `visibility` enum('both','catalog','search','none') NOT NULL DEFAULT 'both',
  `cache_is_pack` tinyint(1) NOT NULL DEFAULT '0',
  `cache_has_attachments` tinyint(1) NOT NULL DEFAULT '0',
  `is_virtual` tinyint(1) NOT NULL DEFAULT '0',
  `cache_default_attribute` int(10) unsigned DEFAULT NULL,
  `date_add` datetime NOT NULL,
  `date_upd` datetime NOT NULL,
  `advanced_stock_management` tinyint(1) NOT NULL DEFAULT '0',
Link to comment
Share on other sites

Hi ps3z,

 

can you try something for me?

1) Backup file classes/ProductSale.php

2) Edit the file, and find the function : public static function getBestSales(...)

3) scroll down until you see:
 
				GROUP BY product_shop.id_product
				ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'
				LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;

then do this:

 

GROUP BY product_shop.id_product
ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'                    <- take this line out
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
 
Why I try this:

The error message  you gave us complains about an ambiguous field date_add (as there is a field date_add in both ps_product and ps_product_shop ). This field is used for ordering the list, therefore if we take out the order by clause from the SQL query, this may 'solve' it.

 

We may need to fix it differently when this indeed solves the problem of not showing the products. We may just have to add the p.date_add in the order field to really fix it correctly.

 

But let's first see if this solves the initial problem.

 

pascal.

 

ok ill try now

Link to comment
Share on other sites

Hi ps3z,

 

can you try something for me?

1) Backup file classes/ProductSale.php

2) Edit the file, and find the function : public static function getBestSales(...)

3) scroll down until you see:
 
                GROUP BY product_shop.id_product

                ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'

                LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;

 

then do this:

 

GROUP BY product_shop.id_product
ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'                    <- take this line out
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
 
Why I try this:

The error message  you gave us complains about an ambiguous field date_add (as there is a field date_add in both ps_product and ps_product_shop ). This field is used for ordering the list, therefore if we take out the order by clause from the SQL query, this may 'solve' it.

 

We may need to fix it differently when this indeed solves the problem of not showing the products. We may just have to add the p.date_add in the order field to really fix it correctly.

 

But let's first see if this solves the initial problem.

 

pascal.

 

Hey you solved it. :D remained to do anything?

 

Many thanks

Edited by ps3z (see edit history)
Link to comment
Share on other sites

Hi ps3z,

Glad it worked!

 

What you can do is try if the 1.5.6.0 version of the function works (I'll copy it here. Paste it by replacing the whole function in the file we just edited) I just noticed that they did try to fix it there already.

 

If that doesn't work, I'm not sure if you care about the order of your list, but you can quickly/for now fix it by just adding

 

ORDER BY p.`date_add`

 

it then just always orders by date, instead of all kind of order options that can be set.

 

function from 1.5.6.1:

	/*
	** Get required informations on best sales products
	**
	** @param integer $id_lang Language id
	** @param integer $page_number Start from (optional)
	** @param integer $nb_products Number of products to return (optional)
	** @return array from Product::getProductProperties
	*/
	public static function getBestSales($id_lang, $page_number = 0, $nb_products = 10, $order_by = null, $order_way = null)
	{
		if ($page_number < 0) $page_number = 0;
		if ($nb_products < 1) $nb_products = 10;
		$final_order_by = $order_by;
		$order_table = ''; 		
		if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales';
		if ($order_by == 'date_add' || $order_by == 'date_upd')
			$order_table = 'product_shop'; 				
		if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC';
		$groups = FrontController::getCurrentCustomerGroups();
		$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
		$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
		
		$prefix = '';
		if ($order_by == 'date_add')
			$prefix = 'p.';
		
		$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
					pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
					pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
					m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
					MAX(image_shop.`id_image`) id_image, il.`legend`,
					ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
					DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
					INTERVAL '.$interval.' DAY)) > 0 AS new
				FROM `'._DB_PREFIX_.'product_sale` ps
				LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
				'.Shop::addSqlAssociation('product', 'p', false).'
				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 (i.`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`)
				LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`)
					AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
					AND tr.`id_state` = 0
				LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
				'.Product::sqlStock('p').'
				WHERE product_shop.`active` = 1
					AND product_shop.`visibility` != \'none\'
					AND p.`id_product` IN (
						SELECT cp.`id_product`
						FROM `'._DB_PREFIX_.'category_group` cg
						LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
						WHERE cg.`id_group` '.$sql_groups.'
					)
				GROUP BY product_shop.id_product
				ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.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 ($final_order_by == 'price')
			Tools::orderbyPrice($result, $order_way);
		if (!$result)
			return false;
		return Product::getProductsProperties($id_lang, $result);
	}

Just copy the whole function, delete the function in the file we just edited and replace with above one. save and see if it works.

if not, copy the original backed up file over the one we just changed (Still keep a backup of the original one!) and either change the function by deleting the ORDER BY line entirely , or change it by the suggested ORDER BY p.`date_add` line

 

Hope that's it!

 

pascal

Link to comment
Share on other sites

Hi ps3z,

Glad it worked!

 

What you can do is try if the 1.5.6.0 version of the function works (I'll copy it here. Paste it by replacing the whole function in the file we just edited) I just noticed that they did try to fix it there already.

 

If that doesn't work, I'm not sure if you care about the order of your list, but you can quickly/for now fix it by just adding

 

ORDER BY p.`date_add`

 

it then just always orders by date, instead of all kind of order options that can be set.

 

function from 1.5.6.1:

	/*
	** Get required informations on best sales products
	**
	** @param integer $id_lang Language id
	** @param integer $page_number Start from (optional)
	** @param integer $nb_products Number of products to return (optional)
	** @return array from Product::getProductProperties
	*/
	public static function getBestSales($id_lang, $page_number = 0, $nb_products = 10, $order_by = null, $order_way = null)
	{
		if ($page_number < 0) $page_number = 0;
		if ($nb_products < 1) $nb_products = 10;
		$final_order_by = $order_by;
		$order_table = ''; 		
		if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales';
		if ($order_by == 'date_add' || $order_by == 'date_upd')
			$order_table = 'product_shop'; 				
		if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC';
		$groups = FrontController::getCurrentCustomerGroups();
		$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
		$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
		
		$prefix = '';
		if ($order_by == 'date_add')
			$prefix = 'p.';
		
		$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
					pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
					pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
					m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
					MAX(image_shop.`id_image`) id_image, il.`legend`,
					ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
					DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
					INTERVAL '.$interval.' DAY)) > 0 AS new
				FROM `'._DB_PREFIX_.'product_sale` ps
				LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
				'.Shop::addSqlAssociation('product', 'p', false).'
				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 (i.`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`)
				LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`)
					AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
					AND tr.`id_state` = 0
				LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
				'.Product::sqlStock('p').'
				WHERE product_shop.`active` = 1
					AND product_shop.`visibility` != \'none\'
					AND p.`id_product` IN (
						SELECT cp.`id_product`
						FROM `'._DB_PREFIX_.'category_group` cg
						LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
						WHERE cg.`id_group` '.$sql_groups.'
					)
				GROUP BY product_shop.id_product
				ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.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 ($final_order_by == 'price')
			Tools::orderbyPrice($result, $order_way);
		if (!$result)
			return false;
		return Product::getProductsProperties($id_lang, $result);
	}

Just copy the whole function, delete the function in the file we just edited and replace with above one. save and see if it works.

if not, copy the original backed up file over the one we just changed (Still keep a backup of the original one!) and either change the function by deleting the ORDER BY line entirely , or change it by the suggested ORDER BY p.`date_add` line

 

Hope that's it!

 

pascal

 

im checking. i think you mean delete all codes inside of productsale.php and replace with yours righ?

Link to comment
Share on other sites

Probably forgot to delete the old function.

 

Let try this. Replace the whole file contents with this one:

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

class ProductSaleCore
{
	/*
	** Fill the `product_sale` SQL table with data from `order_detail`
	** @return bool True on success
	*/
	public static function fillProductSales()
	{
		$sql = 'REPLACE INTO '._DB_PREFIX_.'product_sale
				(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
				SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
							FROM '._DB_PREFIX_.'order_detail od GROUP BY od.product_id';
		return Db::getInstance()->execute($sql);
	}

	/*
	** Get number of actives products sold
	** @return int number of actives products listed in product_sales
	*/
	public static function getNbSales()
	{
		$sql = 'SELECT COUNT(ps.`id_product`) AS nb
				FROM `'._DB_PREFIX_.'product_sale` ps
				LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ps.`id_product`
				'.Shop::addSqlAssociation('product', 'p', false).'
				WHERE product_shop.`active` = 1';
		return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
	}

	/*
	** Get required informations on best sales products
	**
	** @param integer $id_lang Language id
	** @param integer $page_number Start from (optional)
	** @param integer $nb_products Number of products to return (optional)
	** @return array from Product::getProductProperties
	*/
	public static function getBestSales($id_lang, $page_number = 0, $nb_products = 10, $order_by = null, $order_way = null)
	{
		if ($page_number < 0) $page_number = 0;
		if ($nb_products < 1) $nb_products = 10;
		$final_order_by = $order_by;
		$order_table = ''; 		
		if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales';
		if ($order_by == 'date_add' || $order_by == 'date_upd')
			$order_table = 'product_shop'; 				
		if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC';
		$groups = FrontController::getCurrentCustomerGroups();
		$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
		$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
		
		$prefix = '';
		if ($order_by == 'date_add')
			$prefix = 'p.';
		
		$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
					pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
					pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
					m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
					MAX(image_shop.`id_image`) id_image, il.`legend`,
					ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
					DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
					INTERVAL '.$interval.' DAY)) > 0 AS new
				FROM `'._DB_PREFIX_.'product_sale` ps
				LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
				'.Shop::addSqlAssociation('product', 'p', false).'
				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 (i.`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`)
				LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`)
					AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
					AND tr.`id_state` = 0
				LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
				'.Product::sqlStock('p').'
				WHERE product_shop.`active` = 1
					AND product_shop.`visibility` != \'none\'
					AND p.`id_product` IN (
						SELECT cp.`id_product`
						FROM `'._DB_PREFIX_.'category_group` cg
						LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
						WHERE cg.`id_group` '.$sql_groups.'
					)
				GROUP BY product_shop.id_product
				ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.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 ($final_order_by == 'price')
			Tools::orderbyPrice($result, $order_way);
		if (!$result)
			return false;
		return Product::getProductsProperties($id_lang, $result);
	}

	/*
	** Get required informations on best sales products
	**
	** @param integer $id_lang Language id
	** @param integer $page_number Start from (optional)
	** @param integer $nb_products Number of products to return (optional)
	** @return array keys : id_product, link_rewrite, name, id_image, legend, sales, ean13, upc, link
	*/
	public static function getBestSalesLight($id_lang, $page_number = 0, $nb_products = 10, Context $context = null)
	{
		if (!$context)
			$context = Context::getContext();
		if ($page_number < 0) $page_number = 0;
		if ($nb_products < 1) $nb_products = 10;

		$groups = FrontController::getCurrentCustomerGroups();
		$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');

		$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, MAX(image_shop.`id_image`) id_image, il.`legend`,
					ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, ps.`date_upd`
				FROM `'._DB_PREFIX_.'product_sale` ps
				LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
				'.Shop::addSqlAssociation('product', 'p').'
				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 (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
				LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
					ON cl.`id_category` = product_shop.`id_category_default`
					AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
				WHERE product_shop.`active` = 1
					AND p.`visibility` != \'none\'
					AND p.`id_product` IN (
						SELECT cp.`id_product`
						FROM `'._DB_PREFIX_.'category_group` cg
						LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
						WHERE cg.`id_group` '.$sql_groups.'
					)
				GROUP BY product_shop.id_product
				ORDER BY ps.`date_upd` DESC
				LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
		if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
			return false;

		foreach ($result as &$row)
		{
		 	$row['link'] = $context->link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
		 	$row['id_image'] = Product::defineProductImage($row, $id_lang);
		}
		return $result;
	}

	public static function addProductSale($product_id, $qty = 1)
	{
		return Db::getInstance()->execute('
			INSERT INTO '._DB_PREFIX_.'product_sale
			(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
			VALUES ('.(int)$product_id.', '.(int)$qty.', 1, NOW())
			ON DUPLICATE KEY UPDATE `quantity` = `quantity` + '.(int)$qty.', `sale_nbr` = `sale_nbr` + 1, `date_upd` = NOW()');
	}

	public static function getNbrSales($id_product)
	{
		$result = Db::getInstance()->getRow('SELECT `sale_nbr` FROM '._DB_PREFIX_.'product_sale WHERE `id_product` = '.(int)$id_product);
		if (!$result || empty($result) || !key_exists('sale_nbr', $result))
			return -1;
		return (int)$result['sale_nbr'];
	}

	public static function removeProductSale($id_product, $qty = 1)
	{
		$total_sales = ProductSale::getNbrSales($id_product);
		if ($total_sales > 1)
			return Db::getInstance()->execute('
				UPDATE '._DB_PREFIX_.'product_sale
				SET `quantity` = `quantity` - '.(int)$qty.', `sale_nbr` = `sale_nbr` - 1, `date_upd` = NOW()
				WHERE `id_product` = '.(int)$id_product
			);
		elseif ($total_sales == 1)
			return Db::getInstance()->delete('product_sale', 'id_product = '.(int)$id_product);
		return true;
	}
}

  • Like 1
Link to comment
Share on other sites

 

Probably forgot to delete the old function.

 

Let try this. Replace the whole file contents with this one:

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

class ProductSaleCore
{
	/*
	** Fill the `product_sale` SQL table with data from `order_detail`
	** @return bool True on success
	*/
	public static function fillProductSales()
	{
		$sql = 'REPLACE INTO '._DB_PREFIX_.'product_sale
				(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
				SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
							FROM '._DB_PREFIX_.'order_detail od GROUP BY od.product_id';
		return Db::getInstance()->execute($sql);
	}

	/*
	** Get number of actives products sold
	** @return int number of actives products listed in product_sales
	*/
	public static function getNbSales()
	{
		$sql = 'SELECT COUNT(ps.`id_product`) AS nb
				FROM `'._DB_PREFIX_.'product_sale` ps
				LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ps.`id_product`
				'.Shop::addSqlAssociation('product', 'p', false).'
				WHERE product_shop.`active` = 1';
		return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
	}

	/*
	** Get required informations on best sales products
	**
	** @param integer $id_lang Language id
	** @param integer $page_number Start from (optional)
	** @param integer $nb_products Number of products to return (optional)
	** @return array from Product::getProductProperties
	*/
	public static function getBestSales($id_lang, $page_number = 0, $nb_products = 10, $order_by = null, $order_way = null)
	{
		if ($page_number < 0) $page_number = 0;
		if ($nb_products < 1) $nb_products = 10;
		$final_order_by = $order_by;
		$order_table = ''; 		
		if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales';
		if ($order_by == 'date_add' || $order_by == 'date_upd')
			$order_table = 'product_shop'; 				
		if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC';
		$groups = FrontController::getCurrentCustomerGroups();
		$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
		$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
		
		$prefix = '';
		if ($order_by == 'date_add')
			$prefix = 'p.';
		
		$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
					pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
					pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
					m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
					MAX(image_shop.`id_image`) id_image, il.`legend`,
					ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
					DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
					INTERVAL '.$interval.' DAY)) > 0 AS new
				FROM `'._DB_PREFIX_.'product_sale` ps
				LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
				'.Shop::addSqlAssociation('product', 'p', false).'
				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 (i.`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`)
				LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`)
					AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
					AND tr.`id_state` = 0
				LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
				'.Product::sqlStock('p').'
				WHERE product_shop.`active` = 1
					AND product_shop.`visibility` != \'none\'
					AND p.`id_product` IN (
						SELECT cp.`id_product`
						FROM `'._DB_PREFIX_.'category_group` cg
						LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
						WHERE cg.`id_group` '.$sql_groups.'
					)
				GROUP BY product_shop.id_product
				ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.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 ($final_order_by == 'price')
			Tools::orderbyPrice($result, $order_way);
		if (!$result)
			return false;
		return Product::getProductsProperties($id_lang, $result);
	}

	/*
	** Get required informations on best sales products
	**
	** @param integer $id_lang Language id
	** @param integer $page_number Start from (optional)
	** @param integer $nb_products Number of products to return (optional)
	** @return array keys : id_product, link_rewrite, name, id_image, legend, sales, ean13, upc, link
	*/
	public static function getBestSalesLight($id_lang, $page_number = 0, $nb_products = 10, Context $context = null)
	{
		if (!$context)
			$context = Context::getContext();
		if ($page_number < 0) $page_number = 0;
		if ($nb_products < 1) $nb_products = 10;

		$groups = FrontController::getCurrentCustomerGroups();
		$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');

		$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, MAX(image_shop.`id_image`) id_image, il.`legend`,
					ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, ps.`date_upd`
				FROM `'._DB_PREFIX_.'product_sale` ps
				LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
				'.Shop::addSqlAssociation('product', 'p').'
				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 (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
				LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
					ON cl.`id_category` = product_shop.`id_category_default`
					AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
				WHERE product_shop.`active` = 1
					AND p.`visibility` != \'none\'
					AND p.`id_product` IN (
						SELECT cp.`id_product`
						FROM `'._DB_PREFIX_.'category_group` cg
						LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
						WHERE cg.`id_group` '.$sql_groups.'
					)
				GROUP BY product_shop.id_product
				ORDER BY ps.`date_upd` DESC
				LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
		if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
			return false;

		foreach ($result as &$row)
		{
		 	$row['link'] = $context->link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
		 	$row['id_image'] = Product::defineProductImage($row, $id_lang);
		}
		return $result;
	}

	public static function addProductSale($product_id, $qty = 1)
	{
		return Db::getInstance()->execute('
			INSERT INTO '._DB_PREFIX_.'product_sale
			(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
			VALUES ('.(int)$product_id.', '.(int)$qty.', 1, NOW())
			ON DUPLICATE KEY UPDATE `quantity` = `quantity` + '.(int)$qty.', `sale_nbr` = `sale_nbr` + 1, `date_upd` = NOW()');
	}

	public static function getNbrSales($id_product)
	{
		$result = Db::getInstance()->getRow('SELECT `sale_nbr` FROM '._DB_PREFIX_.'product_sale WHERE `id_product` = '.(int)$id_product);
		if (!$result || empty($result) || !key_exists('sale_nbr', $result))
			return -1;
		return (int)$result['sale_nbr'];
	}

	public static function removeProductSale($id_product, $qty = 1)
	{
		$total_sales = ProductSale::getNbrSales($id_product);
		if ($total_sales > 1)
			return Db::getInstance()->execute('
				UPDATE '._DB_PREFIX_.'product_sale
				SET `quantity` = `quantity` - '.(int)$qty.', `sale_nbr` = `sale_nbr` - 1, `date_upd` = NOW()
				WHERE `id_product` = '.(int)$id_product
			);
		elseif ($total_sales == 1)
			return Db::getInstance()->delete('product_sale', 'id_product = '.(int)$id_product);
		return true;
	}
}

order way been different than block,also its not correct for top seller

Edited by ps3z (see edit history)
Link to comment
Share on other sites

hmmm, sounds strange, as it takes it's product ID's from the sale table...

maybe search your sales table for the product id you didn't think you sold

 

Not sure what to recommend here..

 

 

top sellers block shows right , i checked products sorting is added as date

Edited by ps3z (see edit history)
Link to comment
Share on other sites

To add to this:

In 1.5.6 they fixed it a little other way, and actually they used not p. (which is the ps_product table) but ps_product_shop table.

 

if ($order_by == 'date_add' || $order_by == 'date_upd')
$order_table = 'product_shop';
 
and then:
ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
 

 

 

the solution above as limited to only `date_add`, not `date_upd` as well, (and they used ps_product, which may or may not be correct, not sure about that)

 

(N.B. some legacy code of the solution given in post #35 is left in 1.5.6.0, where they do fill $prefix with 'p.', but it's never used after that... )

 

My 2 cents,

pascal

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

This is not fixed for me with 1.5.6. I have upgraded from 1.4.11 to 1.5.6 and my top sellers page shows no top sellers. Though there are 4 products in the block itself.

 

Fixed after replacing with the latest github version :

 

https://raw.github.com/PrestaShop/PrestaShop/development/classes/ProductSale.php

Edited by indus (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi Arh,

 

Tables are part of your database. The tables hold the data you add in Back office and front office, like Products, categories, orders, shipping methods etc.

Normally you get to your database by loggin in to your host and use some application like PHPMyAdmin or so, or some other database manager your host provides. Then you need to open your database and open de table needed.

 

However, it's not recommended to hack into your database tables if you're not very sure what you're doing, as the whole system can come to a hold. If you insist doing so, please make sure you have a working database Backup, so you can recover from any mistake...

 

What do you need the products table? What do you want to try to do there? Normally, you don't have to change anything inside the tables directly, only through PrestaShop. If you want to loo at the table info, you can do that here, or use the SQL Manager inside PrestaShop (Advanced Parameters menu) Here you can make a command:

Name: products info:

request: SELECT * FROM ps_product

 

to get the raw contents of your product table

 

 

Let me know what info exactly you are looking for, then I can try to help you finding it.

 

pascal.

Link to comment
Share on other sites

Hi Arh,

 

Tables are part of your database. The tables hold the data you add in Back office and front office, like Products, categories, orders, shipping methods etc.

Normally you get to your database by loggin in to your host and use some application like PHPMyAdmin or so, or some other database manager your host provides. Then you need to open your database and open de table needed.

 

However, it's not recommended to hack into your database tables if you're not very sure what you're doing, as the whole system can come to a hold. If you insist doing so, please make sure you have a working database Backup, so you can recover from any mistake...

 

What do you need the products table? What do you want to try to do there? Normally, you don't have to change anything inside the tables directly, only through PrestaShop. If you want to loo at the table info, you can do that here, or use the SQL Manager inside PrestaShop (Advanced Parameters menu) Here you can make a command:

Name: products info:

request: SELECT * FROM ps_product

 

to get the raw contents of your product table

 

 

Let me know what info exactly you are looking for, then I can try to help you finding it.

 

pascal.

Link to comment
Share on other sites

Thank you for your reply. (Version 1561, Norwegian edition)
I am finishing setting up my webshop. The only thing that is not working properly is the PayPal-module.

This is what happens:

Internal 500 server error,

1. Customer put products in the basket
2. Finally they come to PayPal and click "Pay".
3. The screen becomes totally white.
4. By clicking "Update" in Exploer, the following message appear:
INTERNAL 500 SERVER ERROR
1. <b>PayPal response:</b>
2. CHECKOUTSTATUS -> PaymentActionCompleted
3. TIMESTAMP -> 2014-01-30T23:08:52Z
4. EMAIL -> [email protected]
5. PAYERID -> ME4XNCCDAMKQQ
6. PAYERSTATUS -> verified
7. BUSINESS -> E-dental
8. FIRSTNAME -> Arild Rode
9. LASTNAME -> Hansen
10. COUNTRYCODE -> NO
11. SHIPTONAME -> Arild Hansen
12. SHIPTOSTREET -> Øvre Mastemyr 15
13. SHIPTOCITY -> Skien
14. SHIPTOZIP -> 3736
15. SHIPTOCOUNTRYCODE -> NO
16. SHIPTOCOUNTRYNAME -> Norway
17. ADDRESSSTATUS -> Unconfirmed
18. CURRENCYCODE -> NOK
19. AMT -> 78.00
20. ITEMAMT -> 29.00
21. SHIPPINGAMT -> 49.00
22. HANDLINGAMT -> 0.00
23. TAXAMT -> 0.00
24. INSURANCEAMT -> 0.00
25. SHIPDISCAMT -> 0.00
26. L_NAME0 -> Piercing Cube Orange
27. L_NUMBER0 -> 111
28. L_QTY0 -> 1
29. L_TAXAMT0 -> 0.00
30. L_AMT0 -> 29.00
31. L_DESC0 -> Øre, øye, leppe.Tilfredsstiller EU og US kvalitetsstandard.Størrelse: Pin 8x1mm, Kube 3x3x3mm Tot. 1...
32. L_ITEMWEIGHTVALUE0 -> 0.00000
33. L_ITEMLENGTHVALUE0 -> 0.00000
34. L_ITEMWIDTHVALUE0 -> 0.00000
35. L_ITEMHEIGHTVALUE0 -> 0.00000
36. PAYMENTREQUEST_0_CURRENCYCODE -> NOK
37. PAYMENTREQUEST_0_AMT -> 78.00
38. PAYMENTREQUEST_0_ITEMAMT -> 29.00
39. PAYMENTREQUEST_0_SHIPPINGAMT -> 49.00
40. PAYMENTREQUEST_0_HANDLINGAMT -> 0.00
41. PAYMENTREQUEST_0_TAXAMT -> 0.00
42. PAYMENTREQUEST_0_INSURANCEAMT -> 0.00
43. PAYMENTREQUEST_0_SHIPDISCAMT -> 0.00
44. PAYMENTREQUEST_0_TRANSACTIONID -> 9VC32234ME358981P
45. PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED -> false
46. PAYMENTREQUEST_0_SHIPTONAME -> Arild Hansen
47. PAYMENTREQUEST_0_SHIPTOSTREET -> Øvre Mastemyr 15
48. PAYMENTREQUEST_0_SHIPTOCITY -> Skien
49. PAYMENTREQUEST_0_SHIPTOZIP -> 3736
50. PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE -> NO
51. PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME -> Norway
52. PAYMENTREQUEST_0_ADDRESSSTATUS -> Unconfirmed
53. L_PAYMENTREQUEST_0_NAME0 -> Piercing Cube Orange
54. L_PAYMENTREQUEST_0_NUMBER0 -> 111
55. L_PAYMENTREQUEST_0_QTY0 -> 1
56. L_PAYMENTREQUEST_0_TAXAMT0 -> 0.00
57. L_PAYMENTREQUEST_0_AMT0 -> 29.00
58. L_PAYMENTREQUEST_0_DESC0 -> Øre, øye, leppe.Tilfredsstiller EU og US kvalitetsstandard.Størrelse: Pin 8x1mm, Kube 3x3x3mm Tot. 1...
59. L_PAYMENTREQUEST_0_ITEMWEIGHTVALUE0 -> 0.00000
60. L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0 -> 0.00000
61. L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0 -> 0.00000
62. L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0 -> 0.00000
63. PAYMENTREQUESTINFO_0_TRANSACTIONID -> 9VC32234ME358981P
64. PAYMENTREQUESTINFO_0_ERRORCODE -> 0
65. Cart changed since the last checkout express, please make a new Paypal checkout payment
66. Your cart is empty.

I have spent so many hours with the shop and really need some help with this problem.

I appreciate if you have any suggestions ?
 

Link to comment
Share on other sites

Apparently some error 500 appears. Let's try to turn on debugging to see if you get a more detailed error:

   www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information/

 

and let us know if you get more info on the error.

 

pascal.

 

 

N.B. Apparently, the 500 error empties the basket, so then if you want to pay, it is noticed that the basket has changed and complains when you want to pay (line 65+66):

65. Cart changed since the last checkout express, please make a new Paypal checkout payment
66. Your cart is empty.

Link to comment
Share on other sites

Yes, I will try to do that. All server configurations seems to be ok. The customer receive email from PayPal, and so do I. That means that the only thing that does not appear is the page that says "Your order on Tiva is complete" ++++

PayPal has also been deleted and re-installed.

 

I will try debugging...

Edited by Arh (see edit history)
Link to comment
Share on other sites

I have now seen the error log on the server and there are 2 lines:

 

[Fri Jan 31 15:26:09.166578 2014] [:error] [pid 706730] [client 37.9.53.126:63546] File does not exist: /home/tivano/public_html/admin.php, referer: www.tiva.no

[Fri Jan 31 15:26:07.336602 2014] [:error] [pid 705243] [client 37.9.53.126:61813] File does not exist: /home/tivano/public_html/wp-login.php, referer: www.tiva.no
 

Do you know what this means ?

Link to comment
Share on other sites

  • 2 weeks later...

Hi Ahr,

 

sorry for replying so late. Was sick for a while and busy with some sites.

 

These errors don't seem to have anything to do with the Prestashop error. Seems that you tried to do something with wordpress or so in the afternoon (at 15:35 hours, not in the evening).

 

The Error message should be shown on the screen when turning debug mode on and going through the process of paying using paypal...

 

Let me know how things go.

pascal.

Link to comment
Share on other sites

I really appreciate your answers to my questions. I am familiar with html, perl and office/access. I am using Paypal and database on 3 other websites. I have little experience with php, but I am learning every day. (I hope).

1. 100% shure that the server configurations are ok, including Mcrypt.

2. Checked the database (on the server), it is not easy, without results.

3. Replaced all other files than the database, and the problems are still there.

4. Not knowing when these thing accured.

5. I have red the error log on the server.

 

Before I rebuilt/shut down/choose other cart/ask for paid help, I want to try one more time.

There are 2 misconfigurations: Bestsellers and PayPal.

Let me Choose only the Bestsellers. The bestsellers are on the FO (reduced from 5 to 3). When I click "Show all bestsellers", something like "No bestsellers yet (Norwegian: Ingen bestelgere enda)".

I read from the error log:

PHP Notice: Use of undefined constant _RIJNDAEL_KEY_ - assumed '_RIJNDAEL_KEY_' in /home/tivano/public_html/classes/Cookie.php on line 80

and

PHP Notice: Use of undefined constant _RIJNDAEL_IV_ - assumed '_RIJNDAEL_IV_' in /home/tivano/public_html/classes/Cookie.php on line 80

 

 

Do you think that it is better to rebuilt the site?

Edited by Arh (see edit history)
Link to comment
Share on other sites

1.5.6.1

The problem about Bestsellers is solved. Why ? I am not sure. I have tried allmost everything and finally I did the following:

1. Replaced the hole catalog "Classes". Used the "Classes" from 1.5.6.2. (From 1.5.6.1 didn`t work).

2. Cleared Cache

3. Changed the status for an order. (Changed from Paymant accepted to Delivered).

 

In Bestsalescontroller.php in line 40 I changed the number of "Show all bestsellers" to 8.

If anyone is interesred, line 40 now looks like this:

'products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, 8, $this->orderBy, $this->orderWay),

 

Now I have the PayPal issue to deal with. Maybe it is solved as a result of the above, I don`t know.

Link to comment
Share on other sites

The phpinfo.php displayed wrong results. The free modul from Superstar displayed the correct results. Than I understood that I might tell the .htaccess file were to look for my self-made php.ini.

I put the suPHP_ConfigPath /home/xxxxxx/ in my .htaccess file and all errors are now gone.

Thank you for all tips and ideas. Without this forum thing had been very difficult.

Edited by Arh (see edit history)
Link to comment
Share on other sites

  • 3 months later...
×
×
  • Create New...