Customers who bought this product also purchased... doesn't show any products
ZC version 1.5.7
I encountered a problem with the section Customers who bought this product also purchased... It does not get filled automatically on product pages and stays blank. The problem seems to arise from a change in the file includes\modules\also_purchased_products.php in the new 1.5.7 version of ZC. The solution was to change line 15 of also_purchased_products.php from:
Code:
$also_purchased_products = $db->ExecuteRandomMulti(sprintf(SQL_ALSO_PURCHASED, (int)$_GET['products_id'], (int)$_GET['products_id'], (int)MAX_DISPLAY_ALSO_PURCHASED));
To:
Code:
$also_purchased_products = $db->ExecuteRandomMulti(sprintf(SQL_ALSO_PURCHASED, (int)$_GET['products_id'], (int)$_GET['products_id'], (int)MAX_DISPLAY_ALSO_PURCHASED), MAX_DISPLAY_ALSO_PURCHASED);
The sprintf function takes one additional argument in the last ZC version, namely MAX_DISPLAY_ALSO_PURCHASED but the $db->ExecuteRandomMulti method still requires the value of MAX_DISPLAY_ALSO_PURCHASED otherwise it defaults to zero and nothing gets displayed in the section.
Re: Customers who bought this product also purchased... doesn't show any products
Don't know if the method changed in 1.5.7 but, you may want to check https://docs.zen-cart.com/user/admin...chased-display to make sure your settings match.
Re: Customers who bought this product also purchased... doesn't show any products
Quote:
Originally Posted by
vasilt
ZC version 1.5.7
I encountered a problem with the section Customers who bought this product also purchased... It does not get filled automatically on product pages and stays blank. The problem seems to arise from a change in the file includes\modules\also_purchased_products.php in the new 1.5.7 version of ZC. The solution was to change line 15 of also_purchased_products.php from:
Code:
$also_purchased_products = $db->ExecuteRandomMulti(sprintf(SQL_ALSO_PURCHASED, (int)$_GET['products_id'], (int)$_GET['products_id'], (int)MAX_DISPLAY_ALSO_PURCHASED));
To:
Code:
$also_purchased_products = $db->ExecuteRandomMulti(sprintf(SQL_ALSO_PURCHASED, (int)$_GET['products_id'], (int)$_GET['products_id'], (int)MAX_DISPLAY_ALSO_PURCHASED), MAX_DISPLAY_ALSO_PURCHASED);
The sprintf function takes one additional argument in the last ZC version, namely MAX_DISPLAY_ALSO_PURCHASED but the $db->ExecuteRandomMulti method still requires the value of MAX_DISPLAY_ALSO_PURCHASED otherwise it defaults to zero and nothing gets displayed in the section.
definite bug! thanks!
Re: Customers who bought this product also purchased... doesn't show any products
+1. Thanks for reporting, @vasilt.
Re: Customers who bought this product also purchased... doesn't show any products
Re: Customers who bought this product also purchased... doesn't show any products
Hi,
I have just upgraded to v.1.5.7 from v.1.5.5 and I had the Also Purchased not showing any products. I did make this code change to also_purchased_products.php, but it only showed 1 product (had correct values in Admin->Config with min. set to 1 and max. set to 15) and is now throwing errors in Debug.
The last 2 lines of the Debug, which I am assuming are detailing the error is:
--> PHP Warning: array_replace(): Argument #2 is not an array in /home/#####/public_html/shop/includes/classes/db/mysql/query_factory.php on line 625
Were there other modified files??
Thanks in advance for your help,
Jeff
Re: Customers who bought this product also purchased... doesn't show any products
Just a quick update to my problem.......I had contacted the creator of the template I have purchased at the same time as posting here in the Forum. They have provided me with an updated also_purchased_products.php file that has now resolved my issue and it is now displaying properly.
Thanks,
Jeff
Re: Customers who bought this product also purchased... doesn't show any products
Thanks for confirming that your issue is fixed!