Jump to content

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

Adding Product To Cart Remotely Rate Topic   * * * * * 1 votes

 
  • ooaykac
  • Senior Member
  • Members
  • Join Date: 22-Nov 12
  • 297 posts

Posted 26 January 2015 - 10:40 AM #41

Hello tbirnseth. The code you wrote is rally great. I am trying to use it for my own modification.

You put
// Add to cart button was pressed for single product on advanced list
$_REQUEST['product_data'][$product_id]['amount'] = $amount ? $amount : 1;
if( empty($_REQUEST['product_data']) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
$_REQUEST['product_data'][$product_id] = fn_get_product_data($product_id, $auth);
}

It gets the product. But the product in my shop has Option Combination. Each product variant has its own product code.

Example:
* Product ID: 12, code: YKC
* Option combination 1: Product Code: YKC-1
* Option combination 2: Product Code YKC-2


When I opretaes the code it always select the first option. But I want it to be added second combination which product code is YKC-2.

So, that's why incorrect product is added to cart. How could be chosen the correct product combination according to product code?

I changed query to
$product_id = db_get_field("SELECT product_id FROM ?:product_options_inventory WHERE product_code = ?s", $product_code);
but result is same. because it only finds order_id.

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

Posted 26 January 2015 - 10:01 PM #42

It should be finding a unique product code in the options_inventory table. I must not be understanding the question.

Are you running a current version? What version of the cart are you applying this to? Generally the code works for all versions other than the AREA/BOOTSTRAP security which is version dependent.

Note that there is a newer version at http://ez-ms.com/pri...out.pre.php.txt that fixes an issue where the 2nd item added to a cart did not show the price and recalculate the cart even though the proper price was in the cart.

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.


 
  • ooaykac
  • Senior Member
  • Members
  • Join Date: 22-Nov 12
  • 297 posts

Posted 27 January 2015 - 09:43 AM #43

It should be finding a unique product code in the options_inventory table. I must not be understanding the question.

Are you running a current version? What version of the cart are you applying this to? Generally the code works for all versions other than the AREA/BOOTSTRAP security which is version dependent.

Note that there is a newer version at http://ez-ms.com/pri...out.pre.php.txt that fixes an issue where the 2nd item added to a cart did not show the price and recalculate the cart even though the proper price was in the cart.


I have copied the last modified codes and tested. The result is same. Let me explain. There is a product which product_code is YKC. For example it's a bike. And this bike has 2 options. Red and Black color. The customer has to be select the color to buy. Red color options has a different product_code: YKC-RED The Black bike has a different product code: YKC-BLACK

So:
BIKE -> Product_code: YKC (Product ID: 12)
* RED color -> Product_code: YKC-RED (Product ID: 12)
* BLACK color -> Product_code: YKC-BLACK (Product ID: 12)

I entered followed url to browser: index.php?dispatch=checkout.remote_checkout.YKC-RED@3|YKC-BLACK@1 (Products that added to URL are options of same product.)

The codes add to cart 4 products which product_code is YKC-RED. So, all products that added to cart is same It should be added 3 pieces YKC-RED and 1 piece YKC-BLACK.

I hope I could explain. :( I think problem is about product ID. All product_codes are options of only one product. So, all of their product ID is same. When I try to add different product_codes of different products, it works correctly.

When I enter index.php?dispatch=checkout.remote_checkout.YKC-RED@3|ABC@1

(ABC is the product code of a different item which product ID is different.)

it adds the products correctly to cart.

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

Posted 27 January 2015 - 07:37 PM #44

And what result did you get when you used that URL? Suggest you use 'remote_add' for testing instead of 'remote_checkout'. It's easier to diagnose things.

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.


 
  • ooaykac
  • Senior Member
  • Members
  • Join Date: 22-Nov 12
  • 297 posts

Posted 28 January 2015 - 08:43 AM #45

And what result did you get when you used that URL? Suggest you use 'remote_add' for testing instead of 'remote_checkout'. It's easier to diagnose things.

I tested it by using "remote_add" with this URL: index.php?dispatch=checkout.remote_add.YKC-RED@3|YKC-BLACK@1
The result is same. it doesn't add the products to cart correctly. :(

Below you can see result:
[/font][/color]
[list]
[*]Array
(
	[products] => Array
		(
			[2207138931] => Array
				(
					[product_id] => 12
					[product_code] => YKC-RED
					[product] => BIKE
					[amount] => 4
					[product_options] => Array
						(
							[14] => 49
						)

					[price] => 150
					[stored_price] => N
					[main_pair] => Array
						(
							[pair_id] => 959
							[image_id] => 0
							[detailed_id] => 1074
							[position] => 0
							[detailed] => Array
								(
									[image_path] => http://localhost/images/detailed/1/DB_2011_WILDWOOD-CITI_Blue_LG.jpg
									[alt] =>
									[image_x] => 800
									[image_y] => 523
									[http_image_path] => http://localhost/images/detailed/1/DB_2011_WILDWOOD-CITI_Blue_LG.jpg
									[absolute_path] => C:/wamp/www/images/detailed/1/DB_2011_WILDWOOD-CITI_Blue_LG.jpg
									[relative_path] => detailed/1/DB_2011_WILDWOOD-CITI_Blue_LG.jpg
								)

						)

					[extra] => Array
						(
							[product_options] => Array
								(
									[14] => 49
								)

							[unlimited_download] => N
							[points_info] => Array
								(
									[raw_price] => 30000
									[price] => 30000
									[display_price] => 30000
								)

						)

					[stored_discount] => N
					[company_id] => 1
					[selectable_cart_id] => 2207138931
					[amount_total] => 4
					[options_type] => P
					[exceptions_type] => F
					[modifiers_price] => 120
					[is_edp] => N
					[edp_shipping] => N
					[discount] => 0
					[promotions] => Array
						(
						)

					[base_price] => 30
					[display_price] => 150
				)

		)

	[recalculate] =>
	[user_data] => Array
		(
			[user_id] => 3
			[status] => A
			[user_type] => C
			[user_login] => customer
			[referer] =>
			[is_root] => N
			[company_id] => 0
			[last_login] => 0
			[timestamp] => 1421313732
			[password] => 91ec1f9324753048c0096d036a694f86
			[salt] =>
			[firstname] => Customer
			[lastname] => Customer
			[company] =>
			[email] => customer@example.com
			[phone] => 77 77 777 7777
			[fax] =>
			[url] =>
			[tax_exempt] => N
			[lang_code] => en
			[birthday] =>
			[purchase_timestamp_from] =>
			[purchase_timestamp_to] =>
			[responsible_email] =>
			[last_passwords] =>
			[password_change_timestamp] =>
			[api_key] =>
			[janrain_identifier] =>
			[want_sms] => N
			[usergroups] => Array
				(
				)

			[profile_id] => 2
			[profile_type] => P
			[b_firstname] => Customer
			[b_lastname] => Customer
			[b_address] => 44 Main street
			[b_address_2] =>
			[b_city] => Boston
			[b_county] =>
			[b_state] => MA
			[b_country] => US
			[b_zipcode] => 02134
			[b_phone] =>
			[s_firstname] => Customer
			[s_lastname] => Customer
			[s_address] => 44 Main street
			[s_address_2] =>
			[s_city] => Boston
			[s_county] =>
			[s_state] => MA
			[s_country] => US
			[s_zipcode] => 02134
			[s_phone] =>
			[s_address_type] =>
			[profile_name] => Main
			[fields] => Array
				(
				)

			[b_country_descr] => United States
			[s_country_descr] => United States
			[b_state_descr] => MA
			[s_state_descr] => MA
			[points] => 0
		)

	[points_info] => Array
		(
			[raw_total_price] => 30000
			[total_price] => 30000
		)

	[tax_subtotal] => 0
	[discount] => 0
	[total] => 600
	[amount] => 4
	[original_subtotal] => 600
	[display_subtotal] => 600
	[subtotal] => 600
	[use_discount] =>
	[shipping_required] => 1
	[company_shipping_failed] => 1
	[shipping_failed] => 1
	[stored_taxes] => N
	[shipping_cost] => 0
	[display_shipping_cost] => 0
	[coupons] => Array
		(
		)

	[free_shipping] => Array
		(
		)

	[options_style] => F
	[no_promotions] =>
	[promotions] => Array
		(
		)

	[subtotal_discount] => 0
	[has_coupons] => 1
	[applied_promotions] => Array
		(
		)

	[product_groups] => Array
		(
			[0] => Array
				(
					[name] => Simtech
					[company_id] => 1
					[products] => Array
						(
							[2207138931] => Array
								(
									[product_id] => 12
									[product_code] => YKC-RED
									[product] => BIKE
									[amount] => 4
									[product_options] => Array
										(
											[14] => 49
										)

									[price] => 150
									[stored_price] => N
									[main_pair] => Array
										(
											[pair_id] => 959
											[image_id] => 0
											[detailed_id] => 1074
											[position] => 0
											[detailed] => Array
												(
													[image_path] => http://localhost/images/detailed/1/DB_2011_WILDWOOD-CITI_Blue_LG.jpg
													[alt] =>
													[image_x] => 800
													[image_y] => 523
													[http_image_path] => http://localhost/images/detailed/1/DB_2011_WILDWOOD-CITI_Blue_LG.jpg
													[absolute_path] => C:/wamp/www/images/detailed/1/DB_2011_WILDWOOD-CITI_Blue_LG.jpg
													[relative_path] => detailed/1/DB_2011_WILDWOOD-CITI_Blue_LG.jpg
												)

										)

									[extra] => Array
										(
											[product_options] => Array
												(
													[14] => 49
												)

											[unlimited_download] => N
											[points_info] => Array
												(
													[raw_price] => 30000
													[price] => 30000
													[display_price] => 30000
												)

										)

									[stored_discount] => N
									[company_id] => 1
									[selectable_cart_id] => 2207138931
									[amount_total] => 4
									[options_type] => P
									[exceptions_type] => F
									[modifiers_price] => 120
									[is_edp] => N
									[edp_shipping] => N
									[discount] => 0
									[promotions] => Array
										(
										)

									[base_price] => 30
									[display_price] => 150
								)

						)

					[package_info] => Array
						(
							[C] => 600
							[W] => 0.01
							[I] => 4
							[shipping_freight] => 0
							[packages] => Array
								(
									[0] => Array
										(
											[products] => Array
												(
													[2207138931] => 4
												)

											[amount] => 4
											[weight] => 0.1
											[cost] => 120
										)

								)

							[origination] => Array
								(
									[name] => Simtech
									[address] => Boston street
									[city] => Boston
									[country] => US
									[state] => MA
									[zipcode] => 02125
									[phone] => 555555555
									[fax] => +555555555
								)

							[location] => Array
								(
								)

						)

					[all_edp_free_shipping] =>
					[all_free_shipping] =>
					[free_shipping] =>
					[shipping_no_required] =>
					[shippings] => Array
						(
							[1] => Array
								(
									[shipping_id] => 1
									[shipping] => Custom shipping method
									[delivery_time] => 3-5 days
									[rate_calculation] => M
									[service_params] => Array
										(
										)

									[destination] => I
									[min_weight] => 0.00
									[max_weight] => 0.00
									[service_id] => 0
									[module] =>
									[service_code] =>
									[rate_info] => Array
										(
										)

									[group_key] => 0
									[rate] => 0
									[taxed_price] => 0
								)

							[6] => Array
								(
									[shipping_id] => 6
									[shipping] => sürat
									[delivery_time] => 1-3
									[rate_calculation] => M
									[service_params] => Array
										(
										)

									[destination] => I
									[min_weight] => 0.00
									[max_weight] => 0.00
									[service_id] => 0
									[module] =>
									[service_code] =>
									[rate_info] => Array
										(
										)

									[group_key] => 0
									[rate] => 0
									[taxed_price] => 0
								)

						)

				)

		)

	[shipping] => Array
		(
		)

	[chosen_shipping] => Array
		(
		)

	[taxes] => Array
		(
		)

	[tax_summary] => Array
		(
		)

	[calculate_shipping] =>
	[payment_surcharge] => 0
)
[/list]

[color=#282828][font=arial, verdana, tahoma, sans-serif]


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

Posted 28 January 2015 - 09:17 AM #46

Why don't you drop me an email at support "at" ez-ms.com and we can figure this out in your environment. I think I understand that what you're saying . I.e. that the product_code is getting to the right product but the options related to that product are not being set. I think this can be reasonably resolved. But not in the forum! :-)

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.


 
  • vanderex
  • Senior Member
  • Members
  • Join Date: 27-May 10
  • 386 posts

Posted 13 February 2015 - 02:19 PM #47

Same here,

dispatch=checkout.remote_add.BR1500GCA@1

$action = $action ."|MEM01";

seems that the cart shows item MEM01 @ price 0.00 and sometimes doesnt even show it but shows 2 of the BR1500 items..
yes i cleared cart


anyidea on how to force an item on remote_add ?
Get Cost Effective Content Delivery CDN
Unbeatable speed, stats, & price
MaxCDN Site Acceleration

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

Posted 13 February 2015 - 08:27 PM #48

Not quite sure I'm clear on the problem. Does your product BR1500 exist? Is it a standard inventory item or an option combination?
Please drop a note in email (as per #46) above and I'll be happy to try and diagnose any issue. Also, please ensure that you have the latest version located at https://ez-ms.com/pr...out.pre.php.txt There was a change in January related to multiple products....

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.


 
  • vanderex
  • Senior Member
  • Members
  • Join Date: 27-May 10
  • 386 posts

Posted 13 February 2015 - 09:05 PM #49

yes that fix worked.. thanks a mill
Get Cost Effective Content Delivery CDN
Unbeatable speed, stats, & price
MaxCDN Site Acceleration

 
  • digiCovap
  • Newbie
  • Members
  • Join Date: 09-Nov 16
  • 2 posts

Posted 09 November 2016 - 11:02 PM #50

Not quite sure I'm clear on the problem. Does your product BR1500 exist? Is it a standard inventory item or an option combination?
Please drop a note in email (as per #46) above and I'll be happy to try and diagnose any issue. Also, please ensure that you have the latest version located at https://ez-ms.com/pr...out.pre.php.txtThere was a change in January related to multiple products....

 

Hi. Thanks for this mod, still works fine in V.4.3.9 but i have the issue adding second product to cart. When i try to get the code, server says 'access denied'. Can you upload it again? Thanks.



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

Posted 09 November 2016 - 11:26 PM #51

Use this link: https://ez-ms.com/pr...heckout.pre.tgz


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.


 
  • digiCovap
  • Newbie
  • Members
  • Join Date: 09-Nov 16
  • 2 posts

Posted 10 November 2016 - 08:57 AM #52

 

Works perfect, thak you very much for your quick response.



 
  • helmi_pts
  • Member
  • Trial users
  • Join Date: 14-Mar 12
  • 39 posts

Posted 15 September 2017 - 02:05 AM #53

Hi, does anyone have this working for CS 4.6.2? When I tried to remote checkout, it says Your cart is empty, so you cannot proceed to checkout.



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

Posted 15 September 2017 - 08:54 AM #54

Hi, does anyone have this working for CS 4.6.2? When I tried to remote checkout, it says Your cart is empty, so you cannot proceed to checkout.

Are you referring to the code referenced in posting #51?

I'm not aware of anything in that code that would break on 4.6.2 other than the bug in checkout for custom profile fields.  But that affects all checkouts (surprised this wasn't an SP).

What is the URI that you are using including all parameters?


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.


 
  • helmi_pts
  • Member
  • Trial users
  • Join Date: 14-Mar 12
  • 39 posts

Posted 15 September 2017 - 09:40 AM #55

Im using this: https://bookcafe.com...967-411-412-1@1

 

Code used in posting #51.

 

Behavior:

 

1. if no item in cart, it will show 'your cart is empty, so cannot proceed to checkout'

2. if there is item in cart, it will show page not found



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

Posted 15 September 2017 - 05:35 PM #56

I just tried it on my 4.6.2 site and it behaves properly.

What are your security settings for your site (Settings/Security) for the top 4 items?


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.


 
  • helmi_pts
  • Member
  • Trial users
  • Join Date: 14-Mar 12
  • 39 posts

Posted 20 September 2017 - 01:54 AM #57

I just tried it on my 4.6.2 site and it behaves properly.

What are your security settings for your site (Settings/Security) for the top 4 items?

 

Hi tbirnseth,

 

I'm using multi store. So for all stores the settings are:

 

1. enable secure frontend: DISABLE

2. enable secure admin panel: UNCHECKED

3. keep HTTPS: UNCHECKED

4. minimum admin password: 5

 

On the particular store:

 

1. enable secure frontend: SECURE FULL SITE

2. keep HTTPS: CHECKED



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

Posted 20 September 2017 - 05:43 PM #58

Don't know.  Works fine on my multi-store site running 4.6.2 with similar security settings.

Why don't you contact me via email at support at ez-ms.com we can review in detail the link you are using and the exact response you are receiving.


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.


 
  • helmi_pts
  • Member
  • Trial users
  • Join Date: 14-Mar 12
  • 39 posts

Posted 25 September 2017 - 08:28 AM #59

Finally, after much headache I found the cause. Its due to My Changes is not enabled. 



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

Posted 25 September 2017 - 06:12 PM #60

That would do 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.