• Welcome to KonaKart Community Forum. Please login or sign up.
 

Assign product to multiple stores via the SOAP interface

Started by michaelwechner, December 22, 2010, 03:32:26 pm

Previous topic - Next topic

michaelwechner

Hi

We are using the multi-store with a single DB with shared products

If one creates a product, then one can assign this product to multiple stores within konakart admin (top right tab called something like "Shops/Stores").

I would like to do this via the SOAP API, hence I thought one can do this using

http://www.konakart.com/javadoc/admin/com/konakartadmin/appif/KKAdminIf.html

somehow, but I cannot really find the methods/classes to do this for a specific product ID  and specific store ID.

Any pointers are very welcome

Thanks

Michael

julie

You should use the Admin API calls:

getProductsToStores()
insertProductsToStores()
removeProductsToStores()

michaelwechner

Hi Julie

Thanks very much for these pointers. I will give

http://www.konakart.com/javadoc/admin/com/konakartadmin/appif/KKAdminIf.html#insertProductsToStores%28java.lang.String,%20com.konakartadmin.app.AdminProductToStore[]%29

a try shortly and keep you posted on my progress.

Thanks and have a merry Xmas

Michael

michaelwechner

Hi

After many trials and errors we are patching now the database directly with something like

        dispatchOrder(OrderIf order) {
            String storeId = "my-store"; // This should be retrieved from the DB lookup above

            BasePeer.executeStatement("update orders set store_id='" + storeId + "' where orders_id=" + order.getId());

            BasePeer.executeStatement("update orders_products set store_id='" + storeId + "' where orders_id=" + order.getId());

            BasePeer.executeStatement("update orders_products_attributes set store_id='" + storeId + "' where orders_id=" + order.getId());

            BasePeer.executeStatement("update orders_status_history set store_id='" + storeId + "' where orders_id=" + order.getId());

            BasePeer.executeStatement("update orders_total set store_id='" + storeId + "' where orders_id=" + order.getId());
        }

and this works :-)

Nevertheless I think it would be nice to improve KonaKart that something like this could be done via the SOAP API ;-)

Thanks

Michael

julie

The admin app uses the APIs so if you can do it through the admin app you can also do it through the APIs using the API calls that I posted.

Looking at your SQL it seems that you are assigning an order to a store and not a product, which is the subject of the thread.

michaelwechner

Hi Julie

The reason behind the products were the orders (my bad that I didn't make that clear from the beginning).

Just to explain: In order to create orders for different stores based on different customer ZIP codes I understood
that the requirements are that the products are all shared, are all assigned to each store and are assigned to a category for each store, because otherwise the order creation for a specific store didn't work, but rather generated a NullPointerException.

HTH

Michael