Hello,
I do have a little expierence with database tables, but I can't read a db_query I believe to have a query which should enable a product as a bestseller and place it in scroller. I want to fake a bestseller because it looks a little dump when opening a webshop with having a empty bestseller list.
I have manually altered the table "products_ordered" and altered a products column to 3 (like the product is ordered 3 times) still nothing happends in the scroller. What should I do next?
What am I doing wrong?
This is the query:
$best_sellers_scroll_query = tep_db_query("select distinct p.products_id,
pd.products_description, p.products_image, p.products_price,
p.products_tax_class_id, pd.products_name from " .
TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_CATEGORIES . " c where p.products_status = '1' and
p.products_ordered > 0 and p.products_id = pd.products_id and
pd.language_id = '" .
(int)$languages_id . "' and p.products_id = p2c.products_id and
p2c.categories_id = c.categories_id and '" .
(int)$current_category_id . "' in (c.categories_id, c.parent_id)
order by p.products_ordered desc, pd.products_name limit " .
MAX_DISPLAY_BESTSELLERS_SLIDER);
This is the slider.js
var prepare_slider = function(x_cols, x_dur){
var x_pos = 0;
var li_items_n = 0;
var li_col = $('slider_list').getElements('li');
li_col.each(function(li, index){
size = li.getSize();
x_pos += size.x;
li_items_n++;
})
$('slider_list').setStyle('position','relative');
$('slider_list').setStyle('left','0px');
$('slider_list').setStyle('width', x_pos+'px');
/* alert("The element is "+size.x); */
var myFx = new Fx.Tween($('slider_list'), {transition:
Fx.Transitions.Sine.easeOut, duration:x_dur});
myFx.addEvent('start', function(){ is_playing = true; });
myFx.addEvent('complete', function(){ is_playing = false; });
var is_playing = false;
$('left').addEvent('click', function(){
cur_offset = $('slider_list').getStyle('left').toInt();
if (!is_playing && ((cur_offset + size.x) <= 0))
myFx.start('left', cur_offset + size.x + 'px');
});
$('right').addEvent('click', function(){
var is_playing = false;
cur_offset = $('slider_list').getStyle('left').toInt();
if (!is_playing && ((cur_offset - size.x)
>= (x_cols*size.x-x_pos) )) myFx.start('left', cur_offset - size.x + 'px');
});
}
Outcome of the dump:
string(179) "4' and p.products_id = p2c.products_id
and p2c.categories_id = c.categories_id and '0' in (c.categories_id,
c.parent_id) order by p.products_ordered desc,
pd.products_name limit 1" 1064 -
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to
use near ''0' at line 1
select distinct p.products_id, pd.products_description,
p.products_image, p.products_price, p.products_tax_class_id,
pd.products_name from products p, products_description pd,
products_to_categories p2c, categories c where
p.products_status = '1' and p.products_ordered > 0 and
p.products_id = pd.products_id and pd.language_id = '0
[TEP STOP]