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.
To enable this I added the following variables to the following files:
Site IDFilenameVariable1Index.php$assign_to_config['ct_msm_show_all'] =TRUE;2Index.php
$assign_to_config['ct_msm_use_site_id'] = 1;
/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