Post by psct » Fri Feb 23, 2018 5:33 pm

Hey
i want to display all latest products and i want that the products that have special price to not be shown here!

I have modified in catalog/model/product.php-> getLatestProducts function

Code: Select all

foreach ($query->rows as $result) {
              $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
   }

with

Code: Select all

foreach ($query->rows as $result) {
                //$this->log->debug("SELECT product_id FROM ". DB_PREFIX ."product_special WHERE product_id =".$result['product_id']);
                $queryCheckSpecial = $this->db->query("SELECT product_id FROM ". DB_PREFIX ."product_special WHERE product_id =".$result['product_id']);


                if (!$queryCheckSpecial->row){

                    $product_data[$result['product_id']] = $this->getProduct($result['product_id']);

                }else{
                continue;

                }
                
			}
and it doesn't work !

any help will be appreciated !
thak you

Newbie

Posts

Joined
Fri Feb 23, 2018 5:25 pm

Post by straightlight » Sat Feb 24, 2018 2:04 am

As a new forum user, please read the most recent forum rules. No OC version posted.
and it doesn't work !
More info.

However, rather using the already implemented special array key from the catalog/model/catalog/product.php file instead of querying the database yourself. Something like:

Code: Select all

if (isset($result['special']) && !$result['special']) {
// Your code here
}
During the loop, this will exclude all specials.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 13 guests