Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Add Product to Cart that doesn't Exist? Rate Topic   - - - - -

 
  • profs77
  • Member
  • Members
  • Join Date: 26-Sep 12
  • 21 posts

Posted 27 February 2013 - 01:37 AM #1

Hey guys, how can I add a product to the cart that doesn't exist in the product inventory. I am getting product data from a broker platform, adding my percentage margin to the price and displaying it on the website search results. However if I want it so that someone can add the product to the cart, how can this be done? I searched fn.cart.php for the add to cart function and it expects a product_id throughout the function. However the products don't exist in the cart.

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12028 posts

Posted 27 February 2013 - 05:54 AM #2

Intercept your feed and look up the products by their product code. If it doesn't exist, build the proper structure and create it.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 

Posted 27 February 2013 - 07:29 AM #3

Hi There,


To add a product if there is no inventory then follow these steps:

####################
Go to Admin panel->Settings->General.
Under The Catalog Heading, there will be option "Allow negative amount in inventory". Check the box next to it and save the data.
This will allow the customer to add any product to cart whose inventory is Zero.
####################

Hope this helps.
Chilliapple Ltd.
Registered Solution Partner of Cs-cart

http://chilliapple.co.uk

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 27 February 2013 - 10:09 AM #4

Correct me if I'm wrong...but that response is completely irrelevent? Amount of stock is irrelevent if the product_id does not exist in the database.
Hire StellarBytes for CS-Cart Design & Development Services

 
  • profs77
  • Member
  • Members
  • Join Date: 26-Sep 12
  • 21 posts

Posted 27 February 2013 - 05:38 PM #5

Yea I might not have phrased it properly in the first sentence but the rest explains what I'm trying to do. I would like to bypass stucturing the database to contain the product, because I do not want to create new products in the store, I want to leave those alone. I just want to be able to add products to the cart that do not exist in my store. There must be a way to add stuff to the cookie or something.

 
  • profs77
  • Member
  • Members
  • Join Date: 26-Sep 12
  • 21 posts

Posted 27 February 2013 - 08:28 PM #6

I tried doing a test by adding something like this to the beginning of fn_add_product_to_cart function in /core/fn.cart.php , it didn't work.

$cart['products']['777777777777']['amount'] = 1;
$cart['products']['777777777777']['product_options'] = array();
$cart['products']['777777777777']['price'] = 777;
$cart['products']['777777777777']['stored_price'] = "N";
$cart['products']['777777777777']['extra']['product_options'] = array();
$cart['products']['777777777777']['extra']['unlimited_download'] = "N";
$cart['products']['777777777777']['extra']['return_period'] = 1;
$cart['products']['777777777777']['stored_discount'] = "N";
$cart['products']['777777777777']['company_id'] = 0;
$cart['products']['777777777777']['return_period'] = 1;
$cart['products']['777777777777']['amount_total'] = 1;
$cart['products']['777777777777']['options_type'] = "P";
$cart['products']['777777777777']['exceptions_type'] = "F";
$cart['products']['777777777777']['modifiers_price'] = 0;
$cart['products']['777777777777']['is_edp'] = "N";
$cart['products']['777777777777']['edp_shipping'] = "N";
$cart['products']['777777777777']['base_price'] = 777;
$cart['products']['777777777777']['display_price'] = 777;


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12028 posts

Posted 28 February 2013 - 01:52 AM #7

Still unclear why you would want to do what you are doing, but....
You might create a new product with a product_code of 'on-the-fly' or something. Make it 'hidden' so it doesn't show.

Then when you add one of these non-existent products to the cart, have a hook that will go in and change the product_code, product (name), price, etc. to your liking.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • profs77
  • Member
  • Members
  • Join Date: 26-Sep 12
  • 21 posts

Posted 01 March 2013 - 12:58 AM #8

I am working on that code that would add it on the fly as a hidden product, that should be a working method for sure. The reason why I am doing this is because our search engine within the site is connecting to a broker platform feed. Imagine like an ebay. We don't want the products added in with our normal inventory and mixed up with the rest. If someone searches for a product on our search, and the broker platform has it, they can make the purchase and we can make the deal like the middleman.