I am using v1.5.1.3.
I have several different customer groups that each have their own set of prices. When I log on as one of my test customers in a discounted group I sometimes see the undiscounted price in the latest or bestsellers. If I follow the link to the product page I see the correct price. This seems like a caching issue, but not sure how to fix it. I've tried going into the product from admin and resaving it, but it still doesn't show the correct price. Any ideas?
I have several different customer groups that each have their own set of prices. When I log on as one of my test customers in a discounted group I sometimes see the undiscounted price in the latest or bestsellers. If I follow the link to the product page I see the correct price. This seems like a caching issue, but not sure how to fix it. I've tried going into the product from admin and resaving it, but it still doesn't show the correct price. Any ideas?
Last edited by xena on Thu Feb 09, 2012 6:26 am, edited 1 time in total.
catalog/model/catalog/product.php
in the function getLatestProducts, find
replace with
some lines below, find
replace with
in the function getBestSellerProducts, find
replace with:
some lines below, find
replace with
in the function getLatestProducts, find
Code: Select all
$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . (int)$limit);
Code: Select all
if ($this->customer->isLogged()) {
$customer_group_id = $this->customer->getCustomerGroupId();
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);
Code: Select all
$this->cache->set('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . (int)$limit, $product_data);
Code: Select all
$this->cache->set('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit, $product_data);
Code: Select all
$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . (int)$limit);
Code: Select all
if ($this->customer->isLogged()) {
$customer_group_id = $this->customer->getCustomerGroupId();
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);
Code: Select all
$this->cache->set('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . (int)$limit, $product_data);
Code: Select all
$this->cache->set('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit, $product_data);
Great, thanks! I've put your code into an xml file for anyone who is using vqmod:
Code: Select all
<modification>
<id>Modify formats</id>
<version>1.0</version>
<vqmver>1.0.8</vqmver>
<author>Xena, code by Renato Frota</author>
<!-- modify date formats -->
<file name="catalog/model/catalog/product.php">
<operation>
<search position="replace"><![CDATA[
$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . (int)$limit);
]]></search>
<add><![CDATA[
if ($this->customer->isLogged()) {
$customer_group_id = $this->customer->getCustomerGroupId();
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
$this->cache->set('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . (int)$limit, $product_data);
]]></search>
<add><![CDATA[
$this->cache->set('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit, $product_data);
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . (int)$limit);
]]></search>
<add><![CDATA[
if ($this->customer->isLogged()) {
$customer_group_id = $this->customer->getCustomerGroupId();
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
$this->cache->set('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . (int)$limit, $product_data);
]]></search>
<add><![CDATA[
$this->cache->set('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit, $product_data);
]]></add>
</operation>
</file>
</modification>
Thanks. I made a vqmod for me as well.
Just a suggestion: try to not use full lines as search strings. The after/before operations ever add the new content afoter/before the whole line where the search string was found.
You could search only: $this->cache->get('product.latest
And: $this->cache->set('product.bestseller
Just a suggestion: try to not use full lines as search strings. The after/before operations ever add the new content afoter/before the whole line where the search string was found.
You could search only: $this->cache->get('product.latest
And: $this->cache->set('product.bestseller
Who is online
Users browsing this forum: Amazon [Bot], Baidu [Spider] and 19 guests