Jump to content

[Resolved] prefix order number


keat

Recommended Posts

I'm finally in the process of upgrading all my V3 sites to V6.

My V3 sites all had the cart_order_id prefixed with an identifier as to which site generated the order.

How would I do this on V6 ?

A code snippet would be ideal if possible, that way I don't have to modify any core files.

Link to comment
Share on other sites

Just an FYi... I wrote a CubeCart API, and then on top of that wrote a store integration/management solution. It allows you to run multiple stores across as many domains as you want, but uses a single CubeCart store as your central stock system and management system. All orders go to the one store, updates of orders get sent back to the store of purchase etc. Was a nice solution to reduce admin when you have lots of sites.

It works well, although isn't available as a module as it has a lot of bespoke elements to it. I've deployed it to a few sites and also wrote a more commercial version of an API for a third party to use with their customers.

Fun times :)

Link to comment
Share on other sites

10 minutes ago, Noodleman said:

Just an FYi... I wrote a CubeCart API, and then on top of that wrote a store integration/management solution. It allows you to run multiple stores across as many domains as you want, but uses a single CubeCart store as your central stock system and management system. All orders go to the one store, updates of orders get sent back to the store of purchase etc. Was a nice solution to reduce admin when you have lots of sites.

It works well, although isn't available as a module as it has a lot of bespoke elements to it. I've deployed it to a few sites and also wrote a more commercial version of an API for a third party to use with their customers.

Fun times :)

I considered this with the V3's but never got anywhere.

I found that I could in fact appear to run two URL's from the same database, but never progressed with it.

 

17 minutes ago, Dirty Butter said:

So different stores sell the same product? How do you keep Google from penalizing you for duplicate content?

Could you give some examples of how the prefix identifies each site?

The prefix was modified in gateway.inc.php and would just prefix the order number with a few extra initials.

CPO for CrimpsOnline, CTO for CableTiesOnline, went along the lines CTO-170203-105422-1234. We can then tell at a glance that CableTiesOnline sold the item.

The web sites are not all 100% identical, one might specialise in CableTies and favour CableTie prices, another in CrimpTerminals favouring terminal prices.

Link to comment
Share on other sites

For anyone else wishing to do this

 

Change

$this->_order_id = date('ymd-His-').rand(1000, 9999);


 to

$this->_order_id = "your prefix". date('ymd-His-').rand(1000, 9999);

 

You will need to increase the char length in the database though, as it's currently limed to 18.

 

Link to comment
Share on other sites

I forgot that V3 had an issue where the order Id no longer complied with what was coded and there was another edit in admin/orders/index.php.

So whilst my edit has prefixed my test order, I am unable to do anything with it as a customer.

I assume  its this line of code on order.class:

 

public static function validOrderId($order_id) {
        if(preg_match('#^ [0-9]{6}-[0-9]{6}-[0-9]{4}$#i', $order_id)) {
            return true;


 

Link to comment
Share on other sites

Sorry, I think that I already fixed this.

I got halfway through updating the thread and then got called away to a breakdown.

It's still sitting on my desktop at work,

 

I did something along the lines if(preg_match('#^,  [prefix] {2} [0-9]{6}-[0-9]{6}-[0-9]{4}$#i', $order_id)) {

Link to comment
Share on other sites

The brackets indicate a set of legal characters. If CC is fixed, then try:

if(preg_match('#^'.$GLOBALS[config']->get('config','order_prefix').'[0-9]{6}-[0-9]{6}-[0-9]{4}$#i', $order_id)) {

There would have to be a Store Settings field to indicate this store's order prefix.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...