Wondering if anyone can help me out with this issue I've got. Apologies if my terminology is wrong with any of this - It's landed in my lap and I'm trying to get the issues solved without any prior EE or cartthrob knowledge.

We're using CartThrob with SagePay payment gateway on our website.

When a customer goes onto our site and makes a purchase, all the information seems to be displayed correctly in the cart (both on cartthrob and sagepay), However once the purchase is completed and the order details are downloaded to Sage 50 Accounts 2014, all of the item details are missing and instead we get just one line item "Purchase from Website".

I spoke to the chaps at SagePay who have told me that we need to add a product code to our line items which will pair up with our product codes in Sage Accounts and then the data will pass through correctly.

I found the following info in some of the SagePay documentation...

In order for the download of transactions within Sage 50 to update a product record the first entry in a basket line needs to be the product code of the item within square brackets.

So seemingly I need to simply add the product code in square brackets to each of the 'items' being purchased, only problem is that I have no idea how to go about doing this.

I've had a good root around ExpressionEngine, specifically in the cartthrob settings. I can see our products there, but cant see where I would add the product code info.

Can anyone explain how I would go about doing this, or even just point me in the right direction?

Thanks in advance!

1 Answer 1


How you do this will depend on the fields you have for your product code. If you're using the title field, then this will automatically be carried across to your orders. If you're using a different field for example something like {product_sku}, then you'll need to carry this over into your orders channel.

You can collect any custom data for products as they're added to the cart in Cart Throb.

So in your add to basket form (most likely a {exp:cartthrob:add_to_cart_form} tag, include the following:

<input type="hidden" name="item_options[sage_code]" value="{product_sku}">

The name here can be anything you like, but it needs to be prefixed with item_options. This will ensure is attached to the ordered products.

If by some chance you're using {exp:cartthrob:multi_add_to_cart_form}, you'd need to modify your hidden field to include a {row_id} to ensure the product code is attached to the correct item within the order.

<input type="hidden" name="item_options[{row_id}][sage_code]" value="{product_sku}">

That deals with adding your product codes to the order data, but then getting this information out of Cart Throb can be a little harder because of the way the data is stored in the database. Its serialised and Base 64 encoded, so there's a little bit of leg work needed if you need anything other than the built in reports - although I'm not familiar with import requirements with for Sage.

We've had to create some bespoke reports on a couple of occasions, so have some experience of this if you need any additional guidance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.