Expression Engine MSM and CartThrob

We are building two sites using Multi-site Manager (MSM) for one of our clients using CartThrob to manage the e-commerce end of things.

How to sell products from a channel on a different site.

The client has one site which sells B to C and another which sells wholesale, the sites sell subsets of items from the same pool of products.  So it is important to the client that the products are stored in the same database and in the case of Expression Engine this means the same channel.  You might ask why, it’s simple, who wants to key in hundreds of products twice?

Now the problem with this was that there was no module/plugin off the shelf which could take entries from a channel that is not registered with the current site.  This means that channels from Site 1 cannot be seen on site 2.

CartThrob is MSM compliant so I thought “this is great, we’ve used CartThrob before so it should be reasonably painless to get it up and running”.  However, there is always a “however” isn’t there? CartThrob is MSM compliant but that doesn’t mean you can use entries from another sites channel.  So I asked the guys at CartThrob if there was any way round this.  CartThrob doesn’t/didn’t support this out of the box but guess what?  Chris Newton came to my aid and made some changes so that it would work!  How cool is that?

The code still needed a little tweaking and we had to understand how CartThrob uses the config variables (see Techy Stuff, below).

So now we have two sites using the same products and orders channels from site 1. We added a custom field in the Orders channel to store the name of the site of origin to help the client identify where the orders come from.

Techy stuff

To enable this I added the following variables to the following files:

 

Config variables

Site IDFilenameVariable1Index.php$assign_to_config['ct_msm_show_all'] =TRUE;2Index.php

$assign_to_config['ct_msm_show_all'] =TRUE;
$assign_to_config['ct_msm_use_site_id'] = 1;

N/A/expressionengine \
/config/Config.php$assign_to_config['ct_msm_show_all'] =TRUE;2/themes/third_party/Cartthrob/ \
lib/Extload.php$assign_to_config['site_id'] = 1;

 

N.B. This is in addition to any configuration you need for MSM itself.

This configuration was done on EE version 2.7.3 and Cartthrob 2.5

Climbing Turn logo

Clear understandable advice from Climbing Turn

Give us a call on +44 (0)1438 791010

Let's talk

Other blog items

Merlin Engine API builder

Get Ready… It’s Almost Here!

Full post link to blog item in full link to blog item in full: hover colour

How to prevent Phishing

Phishing is associated with a particular type of nasty fraud.

Full post link to blog item in full link to blog item in full: hover colour

General Data Protection Regulation

This new regulation comes into enforcement on the 25th of May 2018.

Full post link to blog item in full link to blog item in full: hover colour

Lasting Impressions for ExpressionEngine

Lasting Impressions is ExpressionEngine 4 ready!

Full post link to blog item in full link to blog item in full: hover colour

Cyber Security

Five tips on how to keep your business safe

Full post link to blog item in full link to blog item in full: hover colour

Is Your Website Rubbish?

How to measure its success online

Full post link to blog item in full link to blog item in full: hover colour

Top tips to woo customers

Things that customers love

Full post link to blog item in full link to blog item in full: hover colour

Top mistakes that lose you customers

Top 5 mistakes to avoid when publishing on the internet.

Full post link to blog item in full link to blog item in full: hover colour

Is your Web Site Ready for Brexit?

Leaving the EU will bring both threats and opportunities

Full post link to blog item in full link to blog item in full: hover colour

Primary School Children Code HTML

Full post link to blog item in full link to blog item in full: hover colour

Curse of the Brochure Site

Missing the opportunity

Full post link to blog item in full link to blog item in full: hover colour

A Web “Page”

It’s NOT a page!

Full post link to blog item in full link to blog item in full: hover colour

Exceptionally Dull Weirdos

This is a response to Willard Foxton's recent article on the Daily Telegraph blog

Full post link to blog item in full link to blog item in full: hover colour

The Website Machine

What is a website?

Full post link to blog item in full link to blog item in full: hover colour