Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Group / Category Specials


dreamscape

Recommended Posts

does anyone know if there is already a contrib to put entire categories on special (say 20% off) without having to do it one product at a time??

 

I've searched through the contribs and came up empty handed...

 

any idea how one might implement this if there isn't a contribution?

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

Hey, Joshua,

 

If you are unable to find a contribution to do this, I can give you an SQL query that can do it easily.

 

Let me know.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

OK, while I've got a quick second, here's what I was thinking.

 

INSERT INTO specials 

SELECT "", products_id, products_price *.90 as specials_new_products_price, NULL, NULL, NULL, NULL, 1 as status 

FROM 

 products t0,

 products_to_categories t1,

 categories_description t2

WHERE 

t0.products_id = t1.products_id AND

t1.categories_id = t2.categories_id AND

t2.categories_name = SOMETHING

 

Of course, the 'products_price *.90' represents a 10% discount off of the regular price, and the 'SOMETHING' represents a category name.

 

Also, this will create duplicate entries if you already have somehting in that category that is on special. The result of duplicates is that the special will show up twice.

 

I'm sure that with very little development, this query can be put into a php script, with a dropdown for the category, and a input text box for the price. You could also automaticaly delete any specials in the table that are in that category before doing this inset.

 

Anyway, I hope this helps.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

I got a dropdown box in place to select either all categories "TOP", or a specific top category or sub-category:

drop_down_box.jpg

 

I am having some trouble with the query though if a category is selected, with how to deal with the categories and parent categories (say I select books, there are actually no products in books in the database, but there are products in its sub categories... how to match them up)...

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

the following SQL works if you are on a top level category, but not if you select a sub-category or select "top" (the entire catalog):

$new_special_insert_query = tep_db_query("select p.products_id, p.products_price 

             from " 

             . TABLE_PRODUCTS . " p, " 

             . 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 = '" . $HTTP_POST_VARS['cat_id'] . "'");

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

i'm seeing the birth of a new contribution???  :D  whooo hooooooo

 

emiliano

 

maybe if I can get the SQL query worked out to where it inserts all products under a certain category... right now I can only get top level categories to work... I am still trying to figure out how to allow subcategories, and the entire catalog to work...

 

then just a simple way to delete the specials from a category (the query here is simple, just a matter of finding a place to integrate it into the interface)

 

frankly I am really surprised no-one has done this yet...

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

I know this is an old thread, but did anybody work this out?

 

ie. what is the SQL query for sub-categories?

 

thanks

 

Jen

I haven't lost my mind - I have it backed up on disk somewhere.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...