How do I keep the gift certificates from showing up in the New Products listing?
Thanks
Larry
Printable View
How do I keep the gift certificates from showing up in the New Products listing?
Thanks
Larry
The easiest method it to go into phpMyAdmin and edit the products table for the Gift Certificates and change the products_date_added to older than your setting for the New Products in the Maximum Values ...
Quote:
New Product Listing - Limited to ...
Limit the New Product Listing to
0= All Products
1= Current Month
7= 7 Days
14= 14 Days
30= 30 Days
60= 60 Days
90= 90 Days
120= 120 Days
That works, many thanks
Larry
What can be done if your setting is set tp 0, All Products...?
Anyone have a possible solution if I'm keeping New Product Listing to All products...?
Thanks for your time,
Jim
Are all of your Gift Certificates in the same categories_id ...
If you check the master_categories_id for the Gift Certificates are they all the same?
If so, then you could exclude that master_categories_id from the SELECT for the New Products ...
Thanks for the reply Linda!
The Gift Certs are all in the same category separate from all other items.
Would your suggestion require a code modification in one or more files...?
If so, do you know which files need editing...?
Many thanks for your insight!
Jim
This is the change I made to the query statement in /includes/modules/new_products.php
starting around line 17.
Original code
Changed Code (changed in two spots and added comment line)Code:if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit;
} else {
$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
p.products_price
from " . TABLE_PRODUCTS . " p
left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_CATEGORIES . " c
where p.products_id = p2c.products_id
and p2c.categories_id = c.categories_id
and c.parent_id = '" . (int)$new_products_category_id . "'
and p.products_status = 1 " . $display_limit;
}
Code:// added p.master_categories_id != 21 to not select gift cert as new product LNG
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
from " . TABLE_PRODUCTS . " p
where p.master_categories_id != 21
and p.products_status = 1 " . $display_limit;
} else {
$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
p.products_price
from " . TABLE_PRODUCTS . " p
left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_CATEGORIES . " c
where p.products_id = p2c.products_id
and p2c.categories_id = c.categories_id
and p.master_categories_id != 21
and c.parent_id = '" . (int)$new_products_category_id . "'
and p.products_status = 1 " . $display_limit;
}
Gyphon,
Thanks for your input and code snippet!
It worked just fine; however, do you know where the code is for the New Products link in the left sidebox menu as this page displays the Gift Certs as well...
Many Thanks,
Jim
Jim,
I forgot about that one, (I have that box turned off on my store). That file would be /includes/modules/sideboxes/what_new.php starting about line 15:
Original Code
Changed Code (add one line and a comment line)Code:$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . "
limit " . MAX_RANDOM_SELECT_NEW;
Hope that helpsCode://added p.master_categories_id != 21 to not select gift cert as new product LNG
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price
from " . TABLE_PRODUCTS . " p
where p.master_categories_id != 21
and p.products_status = 1 " . $display_limit . "
limit " . MAX_RANDOM_SELECT_NEW;
Larry
Larry,
I really appreciate your time on this issue!
I made the modification to the query but it didn't seem to remove the category from the page listing...
Since I'm using the "OverRides", I tried editing the original, /includes/modules/sideboxes/what_new.php, but this didn't remove the gift certs from the query either...
I reviewed the query mod in the /includes/modules/new_products.php and saw they are pretty much the same mod but couldn't figure what I did wrong...
Any direction appreciated,
Jim
This is the answer!
Once you make a change to the orginal place that copy in your override directory.
Ex: includes/modules/sideboxes/yourtemplate/what_new.php
Look in your override to see if you have what_new.php if so, when you changed the orginal you will notice no effect.
Mark,
Thanks for the reply!
When I stated that I edited the original, I wasn't clear enough in that I had placed the edited version of "what_new.php" in the custom/override dir but didn't see the query function correctly... I then removed the file from the custom/override dir and edited the original thinking this would work, but it didn't...
I know the custom/override dir is functioning because I have other files that have been modified and are functioning correctly.
Hope this clears up the issue I'm having...
I'll give it another go since I'm feeling fresh!
Thanks again,
Jim
I figured out what else needed editing; however, I'm attempting to utilize the Over-Rides System on this but cannot seems to figure the dir structure...
The file is /includes/modules/pages/products_new/header_php.php
How would I use the Over-Rides to incorporate the file changes with the dir listed above...?
I tried several variations of the Over Rides dir structure but ZC keeps using the main .../products_new/header_php.php file...
I've edited this file to include the query mod and it does exclude the Gift Certs but once I attempt this using Over Rides, the query doesn't filter out the Gift Certs...
I'm not seeing the obvious...
Any direction appreciated,
Jim
Sorry- the /pages/ directory is NOT overridable at this time. If you have to modify a header_php file, be sure to keep a copy of your modified file somewhere as a backup so you can replace it/merge your changes with future upgrades.Quote:
The file is /includes/modules/pages/products_new/header_php.php
How would I use the Over-Rides to incorporate the file changes with the dir listed above...?
Kim,
Thanks for the reply!
That explains the problems I was having attempting to get the overrides working!
Thanks again,
Jm
Hello Kim,
Is there documentation regarding which directories are not overridable within the Catalog side of ZC...?
Can I assume the book's reference to Overriding is possible in the current dir as long as the "classic" override dir exists in the same dir...
This sounds confusing but if "classic" is not present, then the Overrides feature doesn't apply for the files residing there...
Thanks again for your time,
Jim
Help!
I have document-general types on my site which I do not wish to be displayed in the new products listing (linked from the categories sidebox).
I tried Gryphon's mod to new_products.php adding the master category id of my documents but it's not working - they still show on the new products listing. Am I missing something?
Zen Cart v1.3.7
Thanks,
Jonathan
Jonathan,
Make sure you also edit "../includes/modules/sideboxes/what_new.php" with the code previously listed, change the Category ID to reflect your documents category ID and that should do it...
You could block products_type 3 which is the Document General products_type code in the products table ...
Well, there you have it!
Linda's suggestion may be the best route as long as you don't have sub-categories in there that you don't want to be excluded...
Thanks for your input Linda!
Linda,
That sounds like an ideal solution as I will also have documents like FAQ, hints and tips etc that also need keeping out of the New Products listings.
Do you have a snippet of code as a starter?
Thanks,
Jonathan
Copy the module:
/includes/new_products.php
To your templates and overrides directory:
/includes/your_template_dir/new_products.php
and add on to the two SELECT statements additions to the WHERE clause for:
p.products_type != 3
Ok,
I edited the new_products.php file as suggested and placed it in includes/modules/AtomicWorkshop_template/new_products.php the edited section is shown below:-
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
from " . TABLE_PRODUCTS . " p
where p.products_type != 3
and p.products_status = 1 " . $display_limit;
} else {
$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
p.products_price
from " . TABLE_PRODUCTS . " p
left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_CATEGORIES . " c
where p.products_id = p2c.products_id
and p2c.categories_id = c.categories_id
and p.products_type != 3
and c.parent_id = '" . (int)$new_products_category_id . "'
and p.products_status = 1 " . $display_limit;
}
But, the two document-general product types (test and peter smarts blah blah blah) still show up when the 'new products...' link is clicked from the categories (products) sidebox.
I also edited the whats_new.php sidebox file and placed it in includes/modules/sideboxes/AtomicWorkshop_template/whats_new.php override and that works fine - when I enable the what's new sidebox, those two document-general products never appear in the sidebox.
Here's a link to the live site:-
www.atomicworkshop.co.uk
Any idea why the 'new products...' link from the Products sidebox still isn't working?
Many Thanks in advance,
Jonathan
The info that I gave you was for the New Products Centerbox ...
For the New Products Listing you would need to edit the SELECT statement in:
/includes/modules/pages/products_new/header_php.php
There are no overrides for this so be sure to backup a copy of the original file as well as your new file for future upgrades ...
Perfect!
Thank you indeed!
Jonathan