Zen Cart Logo
Forums / General Questions / Setting Featured Products by Batch

Setting Featured Products by Batch

Locked

Views: 1,426

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
24 Jul 2006, 2:27 AM
#1
dietcokelemon avatar

dietcokelemon

New Zenner

Join Date:
Jul 2006
Posts:
12
Plugin Contributions:
0

Setting Featured Products by Batch

I am trying to make every item on my site be featured, so they will randomly appear on the front page. Is there some way to do this in one step rather than adding each one to the featured list? Perhaps with EasyPopulate? thanks in advance.

24 Jul 2006, 2:54 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Setting Featured Products by Batch

You could export as data from your products table just the field products_id and import that into an empty featured table ...

This should set all the defaults properly on the fields to be featured products without an expiration date and the status turned on ...

24 Jul 2006, 3:08 PM
#3
dietcokelemon avatar

dietcokelemon

New Zenner

Join Date:
Jul 2006
Posts:
12
Plugin Contributions:
0

Re: Setting Featured Products by Batch

Thanks for responding. I managed to screw something up.. my phpmyadmin skills are not up to par and I shouldn't have ventured in... So now my next question is: how do I fix the featured table? I think I deleted fields and indexes from it. and now I get the error message "1054 Unknown column 'f.products_id' in 'where clause'" on my homepage, and "1054 Unknown column 'status' in 'where clause'" when I try to access featured from admin.

Thanks!

24 Jul 2006, 5:04 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Setting Featured Products by Batch

If you totally blew your featured table ... you can just remake it clean from scratch and start over ...

This will make a clean, empty featured table with all the correct fields

DROP TABLE IF EXISTS featured;
CREATE TABLE featured (
  featured_id int(11) NOT NULL auto_increment,
  products_id int(11) NOT NULL default '0',
  featured_date_added datetime default NULL,
  featured_last_modified datetime default NULL,
  expires_date date NOT NULL default '0001-01-01',
  date_status_change datetime default NULL,
  status int(1) NOT NULL default '1',
  featured_date_available date NOT NULL default '0001-01-01',
  PRIMARY KEY  (featured_id),
  KEY idx_status_zen (status),
  KEY idx_products_id_zen (products_id),
  KEY idx_date_avail_zen (featured_date_available)
) TYPE=MyISAM;

NOTE: Always backup your database before attempting changes etc. and as a regular habit ... just in case ...

24 Jul 2006, 6:56 PM
#5
dietcokelemon avatar

dietcokelemon

New Zenner

Join Date:
Jul 2006
Posts:
12
Plugin Contributions:
0

Re: Setting Featured Products by Batch

Thanks, that really helped me get out of a bind. OK, so last question (promise) -- how do I go about doing what you originally recommended, i.e. copying the product_id table into the featured table? Thanks again.

25 Jul 2006, 2:56 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Setting Featured Products by Batch

Go to phpMyAdmin ...

Click on the products table ...

Click on SQL ...

SELECT products_id from products

Click GO ...

At the bottom click Export ...

Uncheck Structure ...

Check Complete inserts ...

Check Extended inserts ...

Check Save as file ... click GO ...

Save as a file on your computer ...

Edit the file you just saved and change the table name products to featured

Click on the featured table ...

Click Import ...

Browse and find the file you just edited ... and click Go ...

You should now have all products in the featured table ...

NOTE: before attempting this Backup your database!!

15 Feb 2009, 9:55 AM
#7
jenred avatar

jenred

New Zenner

Join Date:
Jul 2004
Location:
Australia
Posts:
48
Plugin Contributions:
0

Re: Setting Featured Products by Batch

Great step by step - thank you! One extra thing I would love though... can you please give all the steps again, only this time tell me how to first clear the Featured table so I don't get duplicates.

I am thinking that every so often (after adding a bunch of products) I will just do this again so that my Featured is actually randomly spotlighting all the products.

15 Feb 2009, 3:34 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Setting Featured Products by Batch

Select the featured table and "empty" it ... no records mean no Featured products ...

And, as always, be sure you backup your database before breaking everything ... :smile: