I can have only one related product? am trying to add more than 1 related product to another one in a different category or same and i just can get one showing up on related products.
I read around looks like a bug? but daniel said it was fixed on the latest release? i just installed the shopping cart yesterday so is the latest version.
Thanks for any help
I read around looks like a bug? but daniel said it was fixed on the latest release? i just installed the shopping cart yesterday so is the latest version.
Thanks for any help
yep same here... version 1.2.9 - I'll have a look at this one later today.
http://www.alreadymade.com
Follow me on twitter.com/alreadymade
In catalog/model/catalog/product.php in the function getProductsRelated and the very long sql query...
Look for language_id = '" . (int)$this->language->getId() . "' GROUP BY pr.product_id ORDER BY pd.name ASC");
Delete bolded.
Here's the entire 'new' sql for you. Works for me... Daniel or other admin, please confirm this 'fix'.
Look for language_id = '" . (int)$this->language->getId() . "' GROUP BY pr.product_id ORDER BY pd.name ASC");
Delete bolded.
Here's the entire 'new' sql for you. Works for me... Daniel or other admin, please confirm this 'fix'.
Code: Select all
$query = $this->db->query("SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->language->getId() . "' AND ss.language_id = '" . (int)$this->language->getId() . "' ORDER BY pd.name ASC");
http://www.alreadymade.com
Follow me on twitter.com/alreadymade
Hi,
I have a different related products issue. It displays 2 of the same product on the front end. I tried using the code pasted above but i get an error that a table does not exist. Here is an example of what it is doing...
http://www.discountdesignerhardware.com ... uct_id=216
here is the sql query
And this is in the template to display the related products
I have a different related products issue. It displays 2 of the same product on the front end. I tried using the code pasted above but i get an error that a table does not exist. Here is an example of what it is doing...
http://www.discountdesignerhardware.com ... uct_id=216
here is the sql query
Code: Select all
public function getProductRelated($product_id) {
$query = $this->db->query("SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM product_related pr LEFT JOIN product p ON (pr.related_id = p.product_id) LEFT JOIN product_description pd ON (p.product_id = pd.product_id) LEFT JOIN manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN stock_status ss ON (p.stock_status_id = ss.stock_status_id) LEFT JOIN product_to_category p2c ON (p.product_id = p2c.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->language->getId() . "' AND ss.language_id = '" . (int)$this->language->getId() . "' ORDER BY pd.name ASC");
return $query->rows;
Code: Select all
<?php if ($products) { ?>
<table class="list">
<?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
<tr>
<?php for ($j = $i; $j < ($i + 4); $j++) { ?>
<td width="25%"><?php if (isset($products[$j])) { ?>
<a href="<?php echo $products[$j]['href']; ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
<a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br />
<span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
<?php if (!$products[$j]['special']) { ?>
<span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span><br />
<?php } else { ?>
<span style="color: #900; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
<?php } ?>
<?php if ($products[$j]['rating']) { ?>
<img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
<?php } ?>
<?php } ?>
what is your cart version? i have the latest one and this works for me and i don't have the problem that you say
check here: http://68.196.1.236/store/index.php?rou ... duct_id=52
check here: http://68.196.1.236/store/index.php?rou ... duct_id=52
You would have to be specific about the problems that you are having in those mods for me to help. Maybe you could start a different topic.
http://www.alreadymade.com
Follow me on twitter.com/alreadymade
Okay when I used the provided correction by readyman the related products were doubling up and in some cases tripling. I think I have resolved this by simply changing it to this:readyman wrote:In catalog/model/catalog/product.php in the function getProductsRelated and the very long sql query...
Look for language_id = '" . (int)$this->language->getId() . "' GROUP BY pr.product_id ORDER BY pd.name ASC");
Delete bolded.
Change the PR to PD and that will stop the 'doubling' / 'tripling'...language_id = '" . (int)$this->language->getId() . "' GROUP BY pd.product_id ORDER BY pd.name ASC");

Kevin Davidson
Purolator Shipping Module
Canpar Shipping Module
VQMod - Paypal Transaction ID to Payment Details
Who is online
Users browsing this forum: No registered users and 81 guests