Page 1 of 1

Get Latest Products except special price

Posted: Fri Feb 23, 2018 5:33 pm
by psct
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

Re: Get Latest Products except special price

Posted: Sat Feb 24, 2018 2:04 am
by straightlight
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.