Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with Product_new.php


JemCraft

Recommended Posts

Posted

I am trying to solve the problem of all my products being listed in the New Products section of my website.

 

I am using the oscommerce knowledgebase fix here.

 

It says

 

In catalog/products_new.php about line 56 find this code:

 

 

$Qproducts = $osC_Database->query('select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from :table_products p left join :table_manufacturers m on (p.manufacturers_id = m.manufacturers_id), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc, pd.products_name');

 

Change to:

 

 

$Qproducts = $osC_Database->query('select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from :table_products p left join :table_manufacturers m on (p.manufacturers_id = m.manufacturers_id), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now()) order by p.products_date_added desc, pd.products_name');

 

However my catalog products_new.php says

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

 

I have tried inserting

 

and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now()

 

after the

 

and pd.language_id = '" . (int)$languages_id . "'

 

however I get the following error on the new products page of my site:

 

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 '' at line 1

 

select count(*) as total from products p left join manufacturers m on (p.manufacturers_id = m.manufacturers_id), products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1'and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now()

 

[TEP STOP]

 

Can anyone help? Please?!

 

Many thanks

Jemma

Posted

Why not just disable the new products module?

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Posted

If what you posted below is actually what you entered, then you are missing a ')' after 'year(now()': it should read:

 

year(now())

 

Fix this to see if you can go any further.

 

Ken

 

I have tried inserting

 

and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now()

 

after the

 

and pd.language_id = '" . (int)$languages_id . "'

 

however I get the following error on the new products page of my site:

 

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 '' at line 1

 

select count(*) as total from products p left join manufacturers m on (p.manufacturers_id = m.manufacturers_id), products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1'and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now()

 

[TEP STOP]

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Posted
Why not just disable the new products module?

 

Because I think it helps people to acutally see what's new on the first page - kind of draws them in a bit further.

 

Thanks GemRock, I'll check my code again.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...