Hey Gents,
( I have the quanity displaying now with the 1.34 version when you pull up the product details ... )
However, would there be a way to display the remaining quantity available on the home page .
Where the latest products are features.
Creating the sense of urgency ...
( I have the quanity displaying now with the 1.34 version when you pull up the product details ... )
However, would there be a way to display the remaining quantity available on the home page .
Where the latest products are features.
Creating the sense of urgency ...
Hello Q and Daniel,
Would either of you have any ideas regarding my objective of having the
Qty in Stock ... display on the home and category page.
My platform will offer "limited editions" and I'm trying to get my landing page (the home page)
to display the Quantity Avaible for each Limted Edition shown.
Thanks for your input guys.
socal
Would either of you have any ideas regarding my objective of having the
Qty in Stock ... display on the home and category page.
My platform will offer "limited editions" and I'm trying to get my landing page (the home page)
to display the Quantity Avaible for each Limted Edition shown.
Thanks for your input guys.
socal
in catalog/controler/common/home.php change
to
then in catalog/view/theme/{yourtheme}/template/common/home.tpl add
somewhere in the products loop wherever you want it. you may need to add appropriate breaks/styling etc.
Code: Select all
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => image_resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite($this->url->http('product/product&product_id=' . $result['product_id']))
);
Code: Select all
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => image_resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'quantity' => $result['quantity'],
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite($this->url->http('product/product&product_id=' . $result['product_id']))
);
Code: Select all
<?php echo $products[$j]['quantity']; ?>
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
in catalog/controller/product/category.php find around line 145
make a new line after that and add
then in catalog/view/theme/{yourtheme}/template/product/category.tpl around line 54 (somewhere in the products loop) add
once again this has no styling whatsoever you can add that as you wish.
Code: Select all
'model' => $result['model'],
Code: Select all
'quantity' => $result['quantity'],
Code: Select all
<?php echo $products[$j]['quantity']; ?>
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Hey Xsecrets
An odd thing happens with the Quantity on the home page...
On the category page the amount is reduced with each sale.
On the product detail page the amount is also reduced with each sale.
Likewise, on the product insert / in administration ... the quantity is reduced with each sale.
However, on the home page the quantity doesn't reduce.
If I start a new session however , and come in new ... sometimes it looks like it's reducing it ... but then sometime not ... it's not consistent. (on the homepage that is... the other reduce quantity just great)
((just tried it again .... it's definately some type of session timing thing .... if I wait a while and come back in sometime later ... it seems to reduce the qty on the home page))
seems like it should reduce it after I checkout and hit the continue button at the very end bringing me back to the home page. ?
any ideas ??
http://www.imageart-studios.com/opencart13/
An odd thing happens with the Quantity on the home page...
On the category page the amount is reduced with each sale.
On the product detail page the amount is also reduced with each sale.
Likewise, on the product insert / in administration ... the quantity is reduced with each sale.
However, on the home page the quantity doesn't reduce.
If I start a new session however , and come in new ... sometimes it looks like it's reducing it ... but then sometime not ... it's not consistent. (on the homepage that is... the other reduce quantity just great)
((just tried it again .... it's definately some type of session timing thing .... if I wait a while and come back in sometime later ... it seems to reduce the qty on the home page))
seems like it should reduce it after I checkout and hit the continue button at the very end bringing me back to the home page. ?
any ideas ??
http://www.imageart-studios.com/opencart13/
Xsecrets, you are correct. It was the cache setup on the home page.
Your solution worked great ! Thanks for your help.
socal
Re: remaining quantiy available
Sent: Tue Dec 01, 2009 4:53 pm
From: Xsecrets
To: socal2
ok I found it. it does cache the latestproducts query in the model file.
in catalog/model/catalog/product.php
please backup before you try this. The code should work, but I haven't tested it.
around line 156 you should see a function like
Code: Select all
public function getLatestProducts($limit) {
$product_data = $this->cache->get('product.latest.' . $this->language->getId() . '.' . $limit);
if (!$product_data) {
$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 p 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) WHERE 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 p.date_added DESC LIMIT " . (int)$limit);
$product_data = $query->rows;
$this->cache->set('product.latest.' . $this->language->getId() . '.' . $limit, $product_data);
}
return $product_data;
}
change it to
Code: Select all
public function getLatestProducts($limit) {
$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 p 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) WHERE 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 p.date_added DESC LIMIT " . (int)$limit);
return $query->rows;
}
if you are putting the qty on the bestsellers you'll run into the same problem as it's cached as well.
Your solution worked great ! Thanks for your help.
socal
Re: remaining quantiy available
Sent: Tue Dec 01, 2009 4:53 pm
From: Xsecrets
To: socal2
ok I found it. it does cache the latestproducts query in the model file.
in catalog/model/catalog/product.php
please backup before you try this. The code should work, but I haven't tested it.
around line 156 you should see a function like
Code: Select all
public function getLatestProducts($limit) {
$product_data = $this->cache->get('product.latest.' . $this->language->getId() . '.' . $limit);
if (!$product_data) {
$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 p 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) WHERE 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 p.date_added DESC LIMIT " . (int)$limit);
$product_data = $query->rows;
$this->cache->set('product.latest.' . $this->language->getId() . '.' . $limit, $product_data);
}
return $product_data;
}
change it to
Code: Select all
public function getLatestProducts($limit) {
$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 p 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) WHERE 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 p.date_added DESC LIMIT " . (int)$limit);
return $query->rows;
}
if you are putting the qty on the bestsellers you'll run into the same problem as it's cached as well.
Who is online
Users browsing this forum: Google [Bot] and 169 guests