Is it possible to receive a product feed via external api? I've looked at the magento api and I can see how to produce an XML web service to feed products out, but I need to feed information into magento.
I have a supplier of products with an XML api (SOAP). Is it possible to connect my magento store to this api?
Magento by default does not support this and in my honest opinion I would not go down the route of doing this with magento. The best way I can see of doing this is the following;
1) Create a custom module with a cron config and model (http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job).
2) In the model you created and the method you defined in the module config, load your data feed and loop through the items. Either create them in magento if they don't exist or update/enable/disable/remove the product in magento if they do.
You can schedule the cron to run every few hours or more frequently if it's quick enough, well optimised and not too intensive. You can get clever and possibly have ajax stock check on product view page to give live stock on the product page. Or to ensure it is is in stock at time of order you could add an event observer for the checkout_cart_product_add_before and query the live stock to check it's actually there (but you need to create the event - magento did not create it Magento checkout_cart_product_add_before and get number of products added).
This will essentially allow you to keep magento working normally without extensively extending and overriding the core files. You could of course have a separate app altogether (maybe java) which does the same via magento's SOAP API and the the third party api.
Related
I have a two seperate websites(f.e. abc.com and 123.com) Shops have the same products, but different prices. I want that these two stores would share product stock and nothing more. So I guess it's just one column from database. Is there a good way to synchronize product stock between two seperate prestashop websites?
In order to achieve your goal. You should use the multistore functionality in Prestashop (sharing products and stock), see doc.prestashop.com/display/PS16/Managing+Multiple+Shops
As I assume you aren't using it for a specific reason, you would need to go and create your own module. Your module should register to the actionUpdateQuantity hook, meaning everytime your stock changes, it should do something, namely send a message to the other shop.
Normally, you would use the Prestashop webservice for this kind of behaviour, but as the webservice has some problems with stock management (see http://forge.prestashop.com/browse/PSCSX-3170, mainly having to do with the advanced stock management). I don't know if you use the ASM functionality, but I've created an example module for syncing your stocks. It can be adapted to be compatible with ASM functionality.
In the module configuration, you'll find the Sync URL of the current shop, you can use that URL in the other shop. So you'll install the module on both shops and cross reference them. I've created a separate sync.php file which will be called to sync the stock. As said, normally you should use the webservice functionality for this (and if you dont use ASM, you can adapt it to use the webservice, if you do use ASM, you must adapt it to allow for stock movements and valuation).
For the code, see the repository at https://github.com/mwienk/prestashop-syncstock
I'm using Woocommerce and trying to make a desktop application which manipulates products and prices (planning to use visual basic).
I've searched the internet a lot however couldn't find a good answer to where the product names and their prices are stored.
Can I manipulate data using php or mysql from desktop?
WooCommerce stores products in the 'posts' table of the schema. Instead of manually updating the DB, I would use the provided API.
From there, you can let WooCommerce handle all of the nitty gritty of updating products, managing the data structure, etc.
This also allows you to not have updates to WooCommerce break your application if they change their DB layout.
WooCommerce API v3
I've planned a custom product page in my Magento shop.
I'll try to explain as best as I can.
When you are in the product list page and you clic on the product that is a configurable product the system goes to set the availability of the single product of the configurable in real time.
First of all you must know that the system manages two differents types of availability that depends in what wharehouse the product is stored.
So, when you go in the configurable product the system check the availability in the first wharehouse and if is not, it goes to parse a web page that contains the availability of the product in the second wharehouse.
I've made a mysql table in the db called 'index' that contains the sku of single products and the relative url of the page to parse to get the real time availability.
Obviusly I haven't the access to the db of the second wharehouse.
Now, it works fine but as you can imaginate the load time is too long.
What's your suggest to improve my web pages?
What I can see it, when multiple users will be going on your website, each time there will be a server level hit to external wharehouse page. This is going to be very much complicated and lot of dependency on the speed and execution of wharehouse's page.
Magento provides Soap API of its own. Any external soap user, if given privileges, can send us the soap request to update the product information.
You can create product attributes you want to check for availability in magento. Ask the wharehouse team to send the automated soap requests to magento whenever any availability is changed for any product.
I have been through this where there is a dependency of other party to check for product availability. Hitting their page everytime is really very much dependent and risky.
I have followed SOAP approach now and everything is peaceful. :)
I'm trying to show a cart icon in Drupal with the number of items in the cart of our sister Magento site.
I'm using the Magento Core API to look up information on customers and use it in Drupal. I'm trying to load the contents of the cart for a specific Magento Customer ID, but I don't see any way to do this. The cart info API method only supports look ups by quote ID. Quote ID appears to be the primary key for a cart.
Is it possible to look up cart information by customer ID with a Magento API?
You can't fetch this information using the Magento Core API, or even the new REST Api. If you wanted this information you'd need to write your own Magento extension and have it installed on the system you're targeting.
The "Cart" object in Magento ties a specific user account to a specific Magento "quote" object. A quote is an order before it's an order object. In Magento's "PHP API" (i.e. the native PHP objects Magento developers use to manipulate the system), this is a sales/quote object.
$quote = Mage::getModel('sales/quote');
Data for this object is stored in the the sales_flat_quote table, and there is a customer_id column so you should be able to get at the information you need.
The customer.info method does not return the active quote id for the customer according to the documentation, so it doesn't look like you can by default. It's pretty easy to extend the core API with a custom module to provide the quote id though. Or you could extend the checkout module and build a new api method that does the lookup by customer id instead and avoid the customer.info request all together. Have a read of http://www.magentocommerce.com/wiki/doc/webservices-api/custom-api for a guide on how to do this. Benefit of having a custom API method is that you can optimize it (Maybe do a query that gives you just the data you want (i.e. Just the number of products for the quote) instead of loading the full quote object).
P.S. Are you making the request for your drupal site by AJAX? I would as the API is slow and you don't want the drupal site hanging for a few seconds whilst you do the lookup.
We are building an e-commerce site where users can create their own bundles with products of their choice. Other users can then buy these bundles.
Please guide me as to how a bundle can be created based on the products selected by user and store this bundle. From whatever little I have read, I can create a module which will do this. Is this the right approach, or is their any other way to do it. I have gone through Alan's post to create modules, but still my magento knowledge is limited.
I am new to magento, and a newbie programmer (hence this is my first post on stackoverflow), any detailed description will greatly help me.
Thanks.
Isn't a shopping cart a user bundle by definition?
You can save the order information and create bundled items from that
Create an administration module that parses the information from orders and chooses automatically the most selected group of packages and creates automatically a product based on that.
If you want to involve the user that is more work for the CRM than for Magento, allowing the user to create bundle products and save them.
Update
From your comments I see 2 ways of solving this issue
with the help of the checkout and order object - when a selection is saved.
without any connection with the checkout process you'll build a frontend module that will save independently a bunch of products and will transform the selection into a backend bundle product that will be later available to all users. Steps to do towards this approach
build the interface to let the user select several products
make a save action that will grab the currently selected products from a cookie or somewhere and tranform that in the background in a product.
save the product and reindex the site to have the product available