Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Can I add a product for a specific customer?

Can I add a product for a specific customer?

Views: 912

Results 1 to 6 of 6
13 Apr 2010, 1:10 PM
#1
lesaurus avatar

lesaurus

New Zenner

Join Date:
Apr 2009
Posts:
2
Plugin Contributions:
0

Can I add a product for a specific customer?

I am trying to set ZC up for the following scenario

I sell digital goods on auction sites.

When an auction is won I want to then send the winner an email directing him to the product on my ZenCart

I only enter the product price - or even the whole product - when i know if and how much they won the product for in the auction.

After following the link i sent them in the email, they arrive at the new products page, click on paypal button and then after payment get the download link.

I want to do it this way so that it is entered on to the ZC system as an order as i like to keep thing simple and in one place.

Points to note:
Obviously the product must only be available to the auction winner, I don't want a site visitor to be able to buy it. I know i could just set the product up as soon as i know it has been sold and then just send them the URL but it will show up in new/featured products and it is possible that some one else could try and buy it

It's basically an invoice for them to pay but set up as a product on ZC

Is there any way to achieve this? Hidden product / url, code or coupon that only allows them to buy, way to send an invoice that still puts them in the system?

Thanks Paul

13 Apr 2010, 4:02 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Can I add a product for a specific customer?

You are basically on the right track... ie: creating a specific product and putting it in a hidden category. (The CATEGORY is "disabled", but the products inside it are not.)

As you are discovering, this does not necessarily HIDE the product from SEARCHES, NEW PRODUCT lists or ALL PRODUCT lists...

So you are going to have to add a "conditional" to the various bits of PHP that govern this.

I have the solution (as I use this myself on some sites) so bear with me while I look for it.

13 Apr 2010, 4:39 PM
#3
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Can I add a product for a specific customer?

The FIRST thing to do is set up your "hidden" category.

Set it up as you would any other category, then "disable" it, by making sure its STATUS icon is red, not green.

Make a note of its ID number of the category (on the left hand side of the categories manager screen, it shows these ID numbers).

NOW... you need to add the following CONDITIONAL to a few php files, and in certain places.

They are all MODULE files

includes/modules/new_products.php
includes/modules/upcoming_products.php

You will see (around lines 22 to 30):

if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
  $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           where p.products_id = pd.products_id
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and   p.products_status = 1 " . $display_limit;

Now, add the line I show in RED

if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
  $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           where p.products_id = pd.products_id
                           and p.master_categories_id != '3'
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and   p.products_status = 1 " . $display_limit;

and p.master_categories_id != '3' means: Only list a product if its master category ID number is NOT equal to 3.

In my example, the category ID = 3, so just insert YOUR category ID number.

You will be able to create an OVER-RIDE for these files (ie: put the edited files into your CUSTOM folder).

If you are not familiar with the CUSTOM template system, (over-rides) then it is a good idea to understand this first.

NEXT... other files that need tweaking are in the PAGES folders, and it should be fairly obvious where other listings will occur where you want the category to be excluded.

includes/pages/advanced_search_result
includes/pages/products_all
includes/pages/products_new

Inside these folders are the header_php.php files

For advanced_search_result/header_php.php. around lines 243 to 250, you will see:

$where_str = " WHERE (p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id' ";

Again... add the CONDITIONAL

$where_str = " WHERE (p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id
               AND p.master_categories_id != '3' ";

In the following:
**
includes/pages/products_all
includes/pages/products_new**

You need to do the same sort of thing in their header_php.php files:

Around line 28 or 29, you will see:

WHERE p.products_status = 1
 AND p.products_id = pd.products_id
 AND pd.language_id = :languageID" . $order_by;

Again, add your conditional

WHERE p.products_status = 1
 AND p.products_id = pd.products_id
 AND pd.language_id = :languageID
 AND p.master_categories_id != '3' " . $order_by;

And that should be it...

Make BACKUPS of all core files before yoiu edit them.


Now... all you need do is when you have "created your product" send the winning bidder the unique URL to that product... it will be something like:

http://www.yourwebsite.com/index.php?main_page=product_info&cPath=3&products_id=255

(as you will see, in my example cPath=3... In yours it will obviously be your own hidden category ID.

13 Apr 2010, 4:45 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Can I add a product for a specific customer?

Oh ... and remember...

While the "hidden" category is DISABLED (its status icon is RED)... the products inside it MUST be ENABLED (their status icons must be GREEN).

13 Apr 2010, 8:29 PM
#5
lesaurus avatar

lesaurus

New Zenner

Join Date:
Apr 2009
Posts:
2
Plugin Contributions:
0

Re: Can I add a product for a specific customer?

Dear Schoolboy,

What can I say! Thats what I call a comprehensive answer. THANKYOU for your time and effort in answering my query.

Normally I would probably look for an easier alternative but seeing as you went to so much trouble i would feel guilty if i at least didn't give it ago!

I'll try tomorrow and let you know how i get on.

Once again Thankyou

Best regards Paul

14 Apr 2010, 10:51 AM
#6
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Can I add a product for a specific customer?

My system will give you the result you want ... so there is not an "easier" way to do this. In fact, I think my method is probably the "easiest" way to render the contents of a category "invisible" to browser users.

It is not difficult to implement, as long as you follow my samples and method.