Is it possible to show the product price in the hot deals block?
Yeah but trying to figure this out myself. Anyone have any suggestions?
Is anyone interested in this functionality. I received a quote of $90 from cs-cart to add this functionality, wondering if anyone wants to split the cost.
UPDATE: cancelled request with cs-cart
I am still looking for anyone that can offer any help on this one.
Maybe TexasGuy can do this!?
[quote name=‘CathyG’]Is it possible to show the product price in the hot deals block?[/QUOTE]
same problem
You should open this file:
skins/YOUR_SKIN/customer/addons/hot_deals_block/blocks/hot_deals.tpl
and change this part of code:
[QUOTE]
{foreach name=“products” from=$items item=“product”}
{if $product.product}
{foreach from=$product.category_ids key=cat_id item=cat_main}
{if $cat_main == “M”}
[/QUOTE]
with this one:
[QUOTE]
{foreach name=“products” from=$items item=“product”}
{if $product.product}
{if $settings.General.alternative_currency == “Y”}
{assign var=‘price’ value=$product.base_price|format_price:$currencies.$primary_currency:$span_id:$class:false}
{else}
{assign var=‘price’ value=$product.base_price|format_price:$currencies.$secondary_currency:$span_id:$class:true}
{/if}
{foreach from=$product.category_ids key=cat_id item=cat_main}
{if $cat_main == “M”}
[/QUOTE]
Then you should open this file:
addons/hot_deals_block/js/jquery.deals.js
and change this part of code:
[QUOTE]
for (i = count; i < count + (differ); i++) {
items[i] = {name: ‘’, link: ‘’, image: images_dir + ‘/spacer.gif’, width: 0, height: 0};
}
[/QUOTE]
with this one:
[QUOTE]
for (i = count; i < count + (differ); i++) {
items[i] = {name: ‘’, link: ‘’, image: images_dir + ‘/spacer.gif’, width: 0, height: 0, price: ‘’};
}
[/QUOTE]
and this part of code:
[QUOTE]
if (items[i].link == ‘’) {
elements.push(‘
} else {
elements.push(‘’);
}
[/QUOTE]
with this one:
[QUOTE]
if (items[i].link == ‘’) {
elements.push(‘
} else {
if (items[i].price != ‘’) {
elements.push(‘’);
}
else {
elements.push(‘’);
}
}
[/QUOTE]
P.S. Make a backup
Anyone sorted this yet
Daka
You should open the folowing file:
/addons/hot_deals_block/js/jquery.deals.js
an change this part of code:
[quote]
for (i = count; i < count + (differ); i++) {
items[i] = {name: ‘’, link: ‘’, image: images_dir + ‘/spacer.gif’, width: 0, height: 0};
}
[/quote]
with this one:
[quote]
for (i = count; i < count + (differ); i++) {
items[i] = {name: ‘’, link: ‘’, image: images_dir + ‘/spacer.gif’, width: 0, height: 0, price: ‘’};
}
[/quote]
and this part:
[quote]
for (var i = idx; i <= idx + this.elements_count - 1; i++) {
if (items[i].link == ‘’) {
elements.push(‘
} else {
elements.push(‘’);
}
preimages[j] = items[i].image;
j++;
}
[/quote]
with this one:
[quote]
for (var i = idx; i <= idx + this.elements_count - 1; i++) {
if (items[i].link == ‘’) {
elements.push(‘
} else {
if (items[i].price != ‘’) {
elements.push(‘’);
}
else {
elements.push(‘’);
}
}
preimages[j] = items[i].image;
j++;
}
[/quote]
Then you should open this file:
/skins/basic/customer/addons/hot_deals_block/blocks/hot_deals.tpl
an change this part of code:
[quote]
{foreach name=“products” from=$items item=“product”}
{if $product.product}
{foreach from=$product.category_ids key=cat_id item=cat_main}
{if $cat_main == “M”}
{include file=“common_templates/image.tpl” image_width=75 image_height=75 obj_id=“$block.block_id
_$product.product_id
” images=$product.main_pair object_type=“product” capture_image=true show_thumbnail=“Y”}
{assign var=“category” value=“,”|explode:$category_list}
{if !$cat_id|in_array:$category}
{$product.category}
{assign var=“category_list” value=“$category_list
,$cat_id
”}
{/if}
{/if}
{/foreach}
{/if}
{/foreach}
[/quote]
with this one:
[quote]
{foreach name=“products” from=$items item=“product”}
{if $product.product}
{strip}{if $settings.General.alternative_currency == “Y”}
{assign var=‘price’ value=$product.base_price|format_price:$currencies.$primary_currency:$span_id:$class:false}
{else}
{assign var=‘price’ value=$product.base_price|format_price:$currencies.$secondary_currency:$span_id:$class:true}
{/if}{/strip}
{foreach from=$product.category_ids key=cat_id item=cat_main}
{if $cat_main == “M”}
{include file=“common_templates/image.tpl” image_width=75 image_height=75 obj_id=“$block.block_id
_$product.product_id
” images=$product.main_pair object_type=“product” capture_image=true show_thumbnail=“Y”}
{assign var=“category” value=“,”|explode:$category_list}
{if !$cat_id|in_array:$category}
{$product.category}
{assign var=“category_list” value=“$category_list
,$cat_id
”}
{/if}
{/if}
{/foreach}
{/if}
{/foreach}
[/quote]
sorry, but doesnt work for me - smarty error for undefind class. IF anyone knows, how can i add price in hot deals please write a method
[quote name=‘pletmintsev’]sorry, but doesnt work for me - smarty error for undefind class. IF anyone knows, how can i add price in hot deals please write a method[/QUOTE]
Which error exactly? I have tried this method earlier and it worked for me. Anyway, I will try to help you
sitemasterly, and sitemaster
which one of the post above is true?
[quote name=‘vidan’]sitemasterly, and sitemaster
which one of the post above is true?[/QUOTE]
They are equal
Any fix ?
price = Zero for all products
Don´t work for me
Fatal error: Smarty error: [in addons/hot_deals_block/blocks/hot_deals.tpl line 31]: syntax error: invalid attribute name: ‘.$primary_currency:$span_id:$class:false’ (Smarty_Compiler.class.php, line 1546)
Please i need some help…
I found the solution to display de Base Price, List Price and the discount:)
I will post very soon the code here.
Replace the /yourskin/customer/addons/hot_deals_block/blocks/hot_deals.tpl
```php
{* $Id: hot_deals.tpl 11896 2011-02-22 13:06:34Z alexions $ }
{* block-description:hot_deals **}
{script src=“addons/hot_deals_block/js/jquery.deals.js”}
{foreach name="products" from=$items item="product"}
{if $product.product}
{strip}
{assign var='price' value=$product.base_price}
{assign var='pricelist' value=$product.list_price}
{assign var='pricediscount' value=$product.list_discount}
{/strip}
{foreach from=$product.category_ids key=cat_id item=cat_main}
{if $cat_main == "M"}
{include file="common_templates/image.tpl" image_width=75 image_height=75 obj_id="`$block.block_id`_`$product.product_id`" images=$product.main_pair object_type="product" capture_image=true show_thumbnail="Y"}
{assign var="category" value=","|explode:$category_list}
{if !$cat_id|in_array:$category}
{assign var="category_list" value="`$category_list`,`$cat_id`"}
{/if}
{/if}
{/foreach}
{/if}
{/foreach}
{section name="index" loop="4"}
{/section}
```
and yoururl/addons/hot_deals_block/js/jquery.deals.js
// $Id: jquery.deals.js 11802 2011-02-09 10:46:38Z klerik $
function Deals(all_items, parent_elm, block_id)
{
this.elements_count = 4;
this.position = 0;
this.speed = 70;
this.max_loading_time = 70; // 7 sec
this.obj_image = [];
this.config = [];
this.all_items = all_items;
this.parent_elm = parent_elm;
this.all_items_count = all_items.length;
this.deal_items = this.all_items;
this.deal_items_count = this.all_items_count;
this.block_id = block_id;
this.config['elements'] = 0;
this.config['use_delay'] = true;
this.config['direction'] = [];
this.init();
};
Deals.prototype = {
init: function()
{
var _deals = this;
$('.cm-deals-left', this.parent_elm).click(function () {
_deals.shift_left(_deals);
});
$('.cm-deals-right', this.parent_elm).click(function () {
_deals.shift_right(_deals);
});
$('.cm-deals-category', this.parent_elm).click(function () {
_deals.change_elements($(this).attr('name'));
});
this.change_elements(0);
},
delay: function(time, func)
{
setTimeout(func, time);
},
use_pagination: function(idx, direction)
{
this.position = idx;
this.set_pagination(this.deal_items_count, (idx == 0) ? 0 : idx / this.elements_count);
this.get_html_items(idx, this.deal_items, true, direction);
},
set_pagination: function(count, idx)
{
var pages = Math.round(count / this.elements_count);
var ret = "";
var add2end = 0;
var add2start = 0;
var output_class;
var end_dif = this.elements_count - idx;
if (end_dif <= this.elements_count && end_dif >= 0) {
add2end += end_dif;
}
var start_dif = this.elements_count - (pages - idx - 1);
if (start_dif <= this.elements_count && start_dif >= 0) {
add2start += start_dif;
}
pagination_list = $(".cm-deals-pagination-list", this.parent_elm);
if (pages == 1) {
pagination_list.css('visibility', "hidden");
} else {
for (var i = 0; i < pages; i++) {
if (i >= (idx - this.elements_count - add2start) && i <= (idx + this.elements_count + add2end)) {
if (i == idx) {
output_class = 'pagination-selected-page';
href = i + 1;
} else {
output_class = '';
href = "" + (i+1) + "";
}
ret += "" + href + " ";
}
}
pagination_list.html(ret);
pagination_list.css('visibility', "visible");
var _deals = this;
$('.cm-deals-pagination', this.parent_elm).click(function () {
_deals.use_pagination(parseInt($(this).attr('name')), 'right');
});
}
},
add_spacers: function(items, count)
{
var differ;
((count % this.elements_count) == 0) ? differ = 0 : differ = this.elements_count - (count % this.elements_count);
for (i = count; i < count + (differ); i++) {
items[i] = {name: '', link: '', image: images_dir + '/spacer.gif', width: 0, height: 0, price: '', pricelist: ''};
}
count += differ;
return {items: items, count: count};
},
filter_elements: function(cat_id, items)
{
var elements = [];
for (i in items) {
if (items[i].cat_id == cat_id) {
elements.push(items[i]);
}
}
ret = this.add_spacers(elements, elements.length);
return {items: ret.items, count: ret.count};
},
change_elements: function(cat_id)
{
if (cat_id == 0) {
ret = this.add_spacers(this.all_items, this.all_items.length);
this.deal_items = ret.items;
this.deal_items_count = ret.count;
} else {
ret = this.filter_elements(cat_id, this.all_items);
this.deal_items = ret.items;
this.deal_items_count = ret.count;
}
this.mark_category(cat_id);
if (this.deal_items_count <= this.elements_count) {
$(".cm-deals-left", this.parent_elm).hide();
$(".cm-deals-right", this.parent_elm).hide();
} else {
$(".cm-deals-left", this.parent_elm).show();
$(".cm-deals-right", this.parent_elm).show();
}
this.position = 0;
this.set_pagination(this.deal_items_count, 0);
this.get_html_items(0, this.deal_items);
},
mark_category: function(cat_id)
{
$('.active', this.parent_elm).removeClass('active');
$('.cm-deals-category', this.parent_elm).each(function(key, elem) {
if (parseInt($(elem).attr('name')) == cat_id) {
$(elem).addClass('active');
}
});
},
load_images: function()
{
use_delay = this.config['use_delay'];
elements = this.config['elements'];
direction = this.config['direction'];
_deals = this;
if (use_delay) {
_deals.delay(_deals.speed,function(){
$(".cm-deals-item-" + direction[0], _deals.parent_elm).html(elements[direction[0]]);
_deals.delay(_deals.speed,function(){
$(".cm-deals-item-" + direction[1], _deals.parent_elm).html(elements[direction[1]]);
_deals.delay(_deals.speed,function(){
$(".cm-deals-item-" + direction[2], _deals.parent_elm).html(elements[direction[2]]);
_deals.delay(_deals.speed,function(){
$(".cm-deals-item-" + direction[3], _deals.parent_elm).html(elements[direction[3]]);
});
});
});
});
} else {
for (i in elements) {
$(".cm-deals-item-" + i, this.parent_elm).html(elements[i]);
}
}
jQuery.toggleStatusBox('hide');
},
check_images: function(count)
{
var is_loaded = true;
for (var j = 0; j <= this.elements_count - 1; j++) {
if (typeof(this.obj_image[j]) == 'object' && !this.obj_image[j].complete) {
is_loaded = false;
}
}
count++;
if (is_loaded || count > this.max_loading_time) {
this.load_images();
} else {
var _deals = this;
setTimeout(function () {
_deals.check_images(count)
}, 100);
}
},
get_html_items: function(idx, items, use_delay, direction)
{
var elements = [];
var direct = [];
var preimages = [];
var is_flash = false;
loaded = 0;
if (direction == "left") {
direction = ['0', '1', '2', '3'];
} else {
direction = ['3', '2', '1', '0'];
}
jQuery.toggleStatusBox('show', lang.loading);
if ($(".hot-deals-list", this.parent_elm)) {
var j = 0;
for (var i = idx; i <= idx + this.elements_count - 1; i++) {
if (items[i].link == '') {
elements.push('
} else {
elements.push('
' + this.truncate(items[i].name) +'
' + items[i].price + '
' + items[i].pricelist + '
' + items[i].pricediscount + '
}
preimages[j] = items[i].image;
j++;
}
}
this.config['elements'] = elements;
this.config['direction'] = direction;
this.config['use_delay'] = use_delay;
for (j = 0; j <= this.elements_count - 1; j++) {
is_flash = (preimages[j].substring(preimages[j].length, preimages[j].length - 3) == 'swf')? true : false;
if (is_flash == false) {
this.obj_image[j] = new Image();
this.obj_image[j].src = preimages[j];
} else {
this.obj_image[j] = false;
}
}
this.check_images(0);
},
shift_left: function(deal_class)
{
deal_class.position = (deal_class.position == 0) ? deal_class.deal_items_count - this.elements_count : deal_class.position - this.elements_count;
deal_class.use_pagination(deal_class.position, 'left');
},
shift_right: function(deal_class)
{
deal_class.position = ((deal_class.position + this.elements_count) == deal_class.deal_items_count) ? 0 : deal_class.position + this.elements_count;
deal_class.use_pagination(deal_class.position, 'right');
},
truncate: function(str)
{
if (str) {
var len = 24;
if (str.length > len) {
str = str.substring(0, len);
str = str.replace(/\w+$/, '')+'...';
}
return str;
}
return '';
}
};
Thanks Hoko!
Is it possible to have 2 differents hot deals block? I mean 1 without prices and another with prices?
Thanks