Jump to content

Products not displayed in New-products,Best sellers,price drop


Recommended Posts

Upgraded my soon to be live shop from 1.4 to 1.5. Now with everything getting displayed after 4 days of struggle.. New-Products, Best-sellers and price-drop pages are not showing any product. However the modules are able to show the same.

 

It is showing warning as :No new products.

 

This means {if $products} in tpl file is not returning any product. This definitely is a problem in core.

 

Can someone please help on quick fix??

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

Here is a quickfix.. I raised a bug PSCFV-4200 but its solution in svn is still not able to resolve the problem.

 

 

Put $this->orderBy as null in function reference in below files:

PricesDropController

NewProductsController

BestSalesController

 

e.g.

'products' => Product::getPricesDrop($this->context->language->id, (int)$this->p - 1, (int)$this->n, false, $this->orderBy, $this->orderWay)

'products' => Product::getPricesDrop($this->context->language->id, (int)$this->p - 1, (int)$this->n, false, null, $this->orderWay)

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

  • 2 weeks later...

I used ORDER BY RAND() in below function:

 

public function getProducts($idcat, $id_lang, $p, $n)
{
 global $cookie;
 if (empty($idcat))
 {
  return false;
 }
 if ($p < 1) $p = 1;
 $sql = '
 SELECT p.*, pl.`link_rewrite`, pl.`name`, i.`id_image`, il.`legend`, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default,
  (p.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1)) AS orderprice
 FROM `'._DB_PREFIX_.'category_product` cp
 LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
 LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)($id_lang).')
 LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).')
 LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`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_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
										 AND tr.`id_country` = '.(int)Country::getDefaultCountryId().'
											AND tr.`id_state` = 0)
  LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
 LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)($id_lang).')
 WHERE cp.`id_category` NOT IN ('.$idcat.') AND p.`active` = 1
 GROUP BY cp.`id_product`
 ORDER BY RAND()
 LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);


 $result = Db::getInstance()->ExecuteS($sql);

 if (!$result)
  return false;
 /* Modify SQL result */
 return Product::getProductsProperties($id_lang, $result);
}

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

  • 2 weeks later...

So I finally found the problem here. The above workaround I posted should not be used because it breaks the sorting functionality.

 

It is a bug in PS1.5 that the product list is not displayed if orderby is selected as date_updated i.e. value 3 for PS_PRODUCTS_ORDER_BY in configuration.

 

To make this work..

BO > Preferences > Products > Pagination > Default order by > Manufacturer

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

WTF!!! It actually solved my problems regarding this! How in earth does that effect on this - have you created bug report related to this?

 

Anyway thank you! Now I don't have that many not working pages on my FO in production! Thanks!

Link to comment
Share on other sites

Another update.. Selecting Manufacturer as order will stop displaying manufacturer list. The only option I found working throughout all pages is :

 

BO > Preferences > Products > Pagination > Default order by > Product Name

 

PS developers did not believed my bug so problem will remain in 1.5 till it is noticed by them :(

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
×
×
  • Create New...