Differences between revisions 37 and 38
Revision 37 as of 2015-05-15 02:54:31
Size: 15745
Editor: clifford
Comment:
Revision 38 as of 2015-05-15 02:55:34
Size: 15771
Editor: clifford
Comment:
Deletions are marked like this. Additions are marked like this.
Line 348: Line 348:

{{attachment:reindex.png}}

Setting up integration with Magento-- Please go through the topic in following order, also when implementing

  1. Introduction
  2. setting up magento and control option
  3. setting up category
  4. import products from Magento.
  5. import Debtor from Magento.
  6. update Products in Magento.
  7. Repopulate Products in Magento.
  8. download orders from Magento.

1,Introduction

This is a document , which design to guild through the integration process step by step.

all the example used in this document is base on the development site for dalesandwaters located in

http://dev.daleandwaters.com.au/

on 05-11

the login detail is as follow

1, the admin page of their development site

http://dev.daleandwaters.com.au/admin

there is password for the site, this is also the password for the xmlrpc service (the on need in braad)

Username: crecom
Password: xVgAEcJ6ccao

and the pass word for the admin page

Username: kafuwong
Password: GfmL9XBk

All magento related error (e.g, fail to add product, of fail to remove product .etc), will be hidden from the user and all log to error.log.

2,Setting up magento and control option

the first step for the integration, is to set up the control options. without the options setup correctly, all the following will not work. there are three places ,needed to be set up.

1, coaad page 2, need to run contrl

  • Enable update to odbc data files = 'Y'
  • Online Store use Cscart/Magento/None = 'M'
  • Lasted downloaded Online order id = "an order number in magento , which and order <= will not get downloaded to control"

2, braad Sales tag, need to run brctrl

  • Webshopper data source -- the xmlrpc interface of magento ,e.g.http://dev.daleandwaters.com.au/api/xmlrpc/

  • webshop login user name -- the user name used to login to magento xmlrpc service, hosting company will need to give us this.
  • webshopper login user password -- provided by the hosting company.
  • Default online Saleperson -- pick any control operator
  • default online customer -- pick any control customer

3, magento side * go to manage attribute sets and create a new set.

  • assign three attributes to the set which contain all color , size and subsize.

4, configure gencont page 3

  • Location for Webshop 1 = "the branch just been configured"
  • default Magento attribute set = "the attribute just set up in magento", this field is a pick list , will only allow you select available set in magento. all item created from control will appear in magento belong to this set. Note that this is not Category.
  • default Magento color attribute = "the attribute which contain all color in magento" is a pick list again, will only allow to pick the attribute belong to the selected set.
  • default Magento size attribute = "the attribute which contain all size in magento"
  • default Magento subsize attribute = "the attribute which contain all subsize in magento"

Screenshot-1-2.png

3,Setting up Category

we do not support , download of category from magento to control , or the other way , the category configuration has to be done manually. there are two way to do this

  1. by impcamin, we need to put in the online_id of magento's category in the column "online_id", the online id of the category can be found in magento admin page , manage Category. here is a example for the possible cat csv for dalesandwaters dev site
  2. or by caaad when , creating a new category in caaad, user can enter the online_id, this field is only editable in creation time, no alteration is allowed after that.
  3. Note that when adding category in Magento, make sure you set under display settings: is anchor = y. This is the setting that makes subcategory products show up on the current category.
  4. If you changed display setting above, you need to reindex: Admin -> System -> Index Management -> "Select All" -> "Reindex data" -> "Submit"

4,Import products from magento

We need to get a csv file from magento, the csv can be obtained in magento admin page, system->Import/Export->profile->exprot_all_product. In case of ftp outbound not working, need to contact the hosting company, for the file.

after that ,

1,need to remove useless column in the header , so it only have the following fields

  1. {"sku", 60,YES},
  2. {"attribute_set", 60,NO},
  3. {"type", 60,NO},
  4. {"category_ids", 31,NO},
  5. {"name", 60,NO},
  6. {"price", 30,NO},
  7. {"status", 30,NO},
  8. {"tax_class_id", 60,NO},
  9. {"description", 1024,NO},
  10. {"qty", 60,NO,NUMBERS},
  11. {"is_in_stock", 60,NO},
  12. {"product_name", 60,NO},
  13. {"special_price", 60,NO},
  14. {"special_from_date", 60,NO},
  15. {"color", 60,NO},
  16. {"cost", 60,NO},
  17. {"weight", 60,NO},

2,and sort the csv in ascending order according to the SKU field

then we will need to run

impmagstmin
to also import qty run
impmagstmin --qoh

select the updated csv file , it may take some time , depending on the size of the csv,

following points are very important , please make sure it is carried out

  • please , make sure when running impmagstmin , the connection has been setup, (thes option in coaad , braad, gencont)

  • please , run this program in the branch , specified in the gencont as webshop location 1, the program is will not choose it for you, you need to do a manual conset.

5,Importing customer from magento

a program was implemented just for this task

impmagcus

four ways to use the program

a,The first time import cust from a magento site run

impmagcus -a

this will pull all customer from magento and match on email. when copying customer data across from magento , onlin_id will be copy over from magneto.

b,after the first time import. need to run the program every night with no argument

impmagcus

buy default it will import customer updated from yestoday and today. for example , when run at 01-01-2015 23:59:59 all customer updated between 31-12-14 00:00:00 to 01-01-2015 23:59:59 will get pulled so the program can be scheduled before or after mid night to retreive all the customer updates.

c,incase overnight didnot run for a period, can still run the program to retrive update happended between a period

impmagcus -f dd-mm-yyyy -t dd-mm-yyyy

will import any updated from and include the -f dd-mm-yyyy to and exclude the -t dd-mm-yyyy

d,or use to retrive a paricular customer from magento by email

impmagcus -e someone@hotmail.com

6,Update/Create product in magento.

  • Any item created in control , we will also create it in magento.
  • when creating product in magento a product set is needed, in control that is stored in gencont, so it is safe to say that all item created in control, will appear in that sat in magento.
  • when creating an item in magento from control , an online_id will be returned from magento , and control will , store that item in the stock record.
  • so any product with out an online_id mean it has not been created in magento, when putbuc that record, we will create it in magento.
  • if a product has online_id , that mean it already exist in magento, when we putbuc we will update the record in magento

NOW there is two way to send item to magento. there is the instance method and the log method. the way we control it , involve programing. as demonstrated below.

by default magento connection has been disabled for most program. we need to turn on the connection on for each individual program, to have them connected.

  1. edit cclib/init.c find the following section

if(!strcmp(prognm,"staad")// the programs we want to connect to magento
       || !strcmp(prognm,"stgaad")
       || !strcmp(prognm,"chmin")
       || !strcmp(prognm,"spost")
       || !strcmp(prognm,"stpost")
       || !strcmp(prognm,"oqpost")
       || !strcmp(prognm,"impmagdrmin")
       || !strcmp(prognm,"impmagord")
       || !strcmp(prognm,"impmagstmin")
       || !strcmp(prognm,"log2magento")
       || !strcmp(prognm,"gencont"))
        suppress_magento = NO;
    if(!strcmp(prognm,"staad")// the program we allow to update magento product records
       || !strcmp(prognm,"stgaad")
       || !strcmp(prognm,"log2magento")
       || !strcmp(prognm,"chmin")
       || !strcmp(prognm,"spost")
       || !strcmp(prognm,"stpost")
       || !strcmp(prognm,"oqpost"))
        suppress_magento_update = NO;
    if(comp.use_cscart == 'm' && !suppress_magento)
        init_magento();

there is a check for suppress_magento this control if we connect to magento for that particular program

we will at least need it set to NO for the following program

  1. log2magento -- need to connect gencont -- need to get the set info so need to connect
  2. impmagstmin -- need to get the online id , so need to connect impmagdrmin -- need to get online id , so need to connect
  3. impmagord -- need to download order from magento so need to connect
  4. staad -- need to get the color and size from magento , to limit user input
  5. stgaad -- same as staad

then there is an other check use to control if that program is allowed to update magento product recordsuppress_magento_updateby default all program should not allow to update magento record. if want the change done by a particular program immediately appear in magento , the set this flag for that program. Also if the flag set for a program the suppress_magento need to set for that program too.

  1. so if we only want the log program to update magento record , then just put log2magento in the check.
  2. if we want to update magento in posting and staad we put staad stgaad stpost spost oqpost in the check.

regardless of how we update the product. in staad the colour/size tab , will be using combo box , to limit the entry to avaliable on in magento. following is pictures indicating the mapping of control field and magento field.

7,Repopulate magento with control product.

to repopulate mean update a lot of product in one goal, it involve two steps

  1. dump the product to log file, preferably a new dblog.dat
  2. send to product over with log2magento

there is different option can be use in log2magento to control the dump.

optino of log2magento

-O stand for OWN, only include item which set is the same as the one in gencont.
-C stand for create, will force to create the record in magento and reassign the new id back to control
-N stand for NEW, only include item which online_id is 0


Three case of importing to magento

1, we had imported from magento using files and the cat was copied over from magento.
fdb2log -B[inetloc] -a9 // only the stock
log2magento -N // only the item with out id

2, we want to dump all control cat and stock into a empty magento
fdb2log -B[inetloc] -a8 // first the cat
log2magento -C //-C incase we have rubbish in online_id
fdb2log -B[inetloc] -a9 // do the stock after cat so all cat was created
log2magento -C //-C incase we have rubbish in online_i

3,want to redump a magento site which has item not created from control.
then we run
fdb2log -B[inetloc] -a9
log2magento -O -C
note the -O here is the item we created in control, because all product import from magento will not be using the control set.
-C mean we force a create, regardless if we have online_id stored in control, we always create the stock in magento and update the id in control.

Please be ware , that running option -C along is dangerous , it is possible to remove online_id of item not created from control.

8,Download order to control

when down load order to control , we will use the program magimpord , it is designed to download a range of order , and it is supposted to run as a cron job

the magimpord will look at the record in coaad.

and try to down load and order with refferenct bigger than it, so it is very important to put in a number , before we first time run impmagord. because if we do not set the field , the program will try to download all existing order, this is bad, as the xml data will be too big to handle , and cause a MV in our xmlrpc-c library.

after each time impmagord run ,it will updae the field in coaad to the last downloaded order. the program will skip an order if it fail on that order and continue on the rest of the orders.

Screenshot-3.png

when downloading orders, control will create or update customer record depending on if the customer exist in control, control , will first try to match online_id if presented in the order , then email will be used for matching.

after down load the orders , need to run oqlstr to make it appear in control

set XMLRPC_TRACE_XML to 1 to display xml returned on screen

Notes:

The images are updated based on files in the images directory that end in _stamp. The last modified of this file has to be older than the image file itself for the Magento image to be updated.

Latest colour size integrations:

a. Installation:

latest integration for child product has been done with a third party magento extension,

http://www.bubblecode.net/en/2012/04/20/magento-api-associate-simple-products-to-configurable-or-grouped-product/

meanually download the extenstion from the aboce webite.

a downloaded zip is located in /u/ccdev/std/magento/magento-improve-api-master.zip

some changes were needed to be done to the extension to suit our need.

1,

in the patch

app/design/adminhtml/base/

should rename to

app/design/adminhtml/default/

if we are using default theme instead of base.

2,

in the file

app/code/community/Bubble/Api/Helper/Catalog/Product.php

the line

$relations = array_fill_keys($usedProductIds, array('qty' => 0, 'position' => 0));

should be

$relations = array_fill_keys($newProductIds, array('qty' => 0, 'position' => 0));

a installed example can be found in

http://www.yourfurniture.crecom.com.au/

admin:support

password:y0urfurniture

B.Limitation

And the following are the limitation of current implementation.

1, the updating of colour size child association on magento , was triggered by adding a new child(or more correctly change the parent of a child).

2, after creating a parent product with at least one child product , then cannot alter the attribute combination

e.g if an item created with only palette . when in a later time we add a size run to it, the size run will not get to magento.

as this cannot be done in the magento back end without deletting the original parent. adding more colours to the palette is ok.

Controling magento inventory level

1, the "Sell Online (Y/N/S)" in stock map to magentos enable and disable , the "s" is equal to "y" as long as not "n" , we will see to enable.

2,to control magento to weather show item out of stock there is two place.

the first one is in the stock itself. which should be set up to use config setting. and the real setup is in the system configuration

stockinventory.png

the second place is in system->configuation->catalog->inventory

configinventory.png

we want to say manage stock to YES

display out of stock product can be set accrodingly.

After changing the options need to reindex for the new options to take effect,very important.

goto system->index management

and reindex all indexs

reindex.png

Magento (last edited 2021-08-23 06:37:05 by 60-240-170-244)