embo Posted December 9, 2016 Share Posted December 9, 2016 In CC3, I'd like to know if there is a way to add a product to cart using PHP. IE: I'd like to just send the CustomerID = 123, ProductID = 11303 and Quantity = 2 Is this possible? When the customer logs in, they'll see the added product(s) in their cart. EDIT: If this can be done in CC6, then I'm willing to do the upgrade... Anyone? Quote Link to comment Share on other sites More sharing options...
bsandall Posted December 29, 2016 Share Posted December 29, 2016 In CubeCart v6 (not sure about earlier versions) you can login as the customer via the admin panel; from there, you could certainly add products to the cart for them. Adding products to customer carts without logging in as them could be done, but as far as I'm aware it is not supported out-of-the-box. I'm sure any developer would be able to help you code something like that. Quote Link to comment Share on other sites More sharing options...
embo Posted December 30, 2016 Author Share Posted December 30, 2016 I figured it out and wrote some code to make it work. Just had to learn this PHP thing. What I was really after was the ability to edit orders. I can now do that. It took a bit of effort to figure out how all the pieces work in CC. Had to modify existing code plus add a new editOrder.Inc.php. I can't believe this was not natively built into CC3. Users had to delete an item and try to remember what options they picked along with the notes they added (we have Estelle's Input Text Mod) then add the item back. Not ideal. Anyways... thanks for the response. Quote Link to comment Share on other sites More sharing options...
bsandall Posted December 30, 2016 Share Posted December 30, 2016 If you just want to be able to edit orders, newer versions of CubeCart allow that. It might be worth considering updating your store. Quote Link to comment Share on other sites More sharing options...
embo Posted December 30, 2016 Author Share Posted December 30, 2016 I tried v6.1.1 and it does not allow me to change the options on an item that was added to the cart. It also doesn't let me edit an order that's in Pending status. Quote Link to comment Share on other sites More sharing options...
bsandall Posted December 30, 2016 Share Posted December 30, 2016 Are you sure you had the correct version? Here is a screenshot of editing item options, and it works the same for pending orders: Quote Link to comment Share on other sites More sharing options...
embo Posted December 30, 2016 Author Share Posted December 30, 2016 That looks like the Admin section. I was already able to edit the orders in there in v3 with Estelle's Add/Edit Orders Mod. However, the users can not edit the options in the front end after adding an item to the cart. With the modifications I made, then can edit the options and text. They can also click on an Edit button in Order History page for Pending orders, and the code will clear the cart, and put the items from the order into the current basket with the associated options and text (Estelle's Text Input Mod). Going through checkout will use the same Order Number to submit the order. Quote Link to comment Share on other sites More sharing options...
bsandall Posted December 30, 2016 Share Posted December 30, 2016 Ah, I see now, you want the customers to be able to edit their orders. I'm not familiar with Estelle's Text Input Mod or any version of CubeCart prior to v6, but as far as I am aware, that is not possible in v6 - once the customer places the order, the only way it can be edited is by contacting the store admin / customer service and asking them to change it. I'm not sure if it is this way through an intentional design decision or that the ability to edit pending orders as a customer was just never implemented - you could create a feature request on GitHub and see what sort of response you get, but it sounds like you've already got yourself sorted out. As for editing an in-progress shopping cart, I think that would be an excellent customer experience improvement, but care would need to be taken not to make the cart too cluttered. Perhaps an 'edit' link which takes you back to the product page with the options you've chosen pre-selected, where adding to the cart would replace whichever entry you clicked from? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.