views:

78

answers:

2

Hi,

I am new to Magento and impressed by the MVC framework that powers it, making module development a well thought out solution. I am strong CakePHP developer.

I am working on a project that uses a dropshipper for the physical products. As a result, every day at 4am a feed needs to be parsed and the products / categories modified, plus stock information. A CRON will be setup to do this.

Additional requirements are: Upon a sucessful order, the system must upload a CSV feed to the Dropshipper via FTP with the order details for distribution. Realtime stock checks, either every hour by CRON or a lookup on the product page

I can think of 2 approaches:

  1. Write everything natively into Magento. As a newbie, this is going to be a big learning curve, but it is the right solution?

  2. Write a simple CakePHP app that runs as a shell. This will use the Magento API to manage all dropshipper processes. This solution will be easier to rollout but introduces an additional system to support.

Does anyone have an advice relating to dropshipping in Magento?

A: 

First, with respect to the product import (product, stock data), make sure to do the real data saving inside of Magento. There have been changes to the catalog implementation in the past, and it's likely with a framework like Magento that there will be more. Keeping it inside the framework will reduce the likelihood of it simply no longer operating and you getting a very unpleasant phone call.

Another advantage to this approach is that, in contrast to the API approach, the native code will not try to spin up the entire framework for every request. This is expensive and to be avoided. Depending on how many products there are, you may need to break the script into multiple executions due to memory leaks when saving catalog products.

Don't tie the stock checks to a catalog page view. Some web crawler will come eat your lunch.

Finally, there's no easy FTP library built into Magento, but throwing that on another cronjob and using system calls to perform the actual (S)FTP call is possibly your easiest option.

Hope that helps!

Thanks, Joe

Joseph Mastey
A: 

I think the answer to this question is simple. Write it in what you know. The biggest reason is "UPGRADES"... with Magento being as high profile, the possibility of being hacked with older versions increase every day. Therefore, when they release new versions, you are going to want to upgrade. With that in mind, are you going to want to add all of your changes into each new version as it is released? Probably not. If there is a solution to write this as a separate tool, that is what you should do.

PROS TO BUILDING OUTSIDE OF MAGENTO

  • No need to re-integrate the upgrades every time a new version of Magento is released.
  • Code is easier to maintain.
  • Tool is easier to write in something you are familiar with.
  • No learning curve.
  • Integration speed will be much quicker.
  • More flexibility since you do not have to fit inside Magento code limitations.
cdburgess
Strongly disagree with this answer. Writing the code outside Magento makes it **more** likely to break with upgrades, not less. Magento changes the data structure from time to time, and code written within the module architecture is insulated by the ORM framework. Code that directly manipulates the database will break. The module framework also performs meta- tasks that must be recreated such as indexing for performance. Also, other modules may have bound to object Save events. And, the Magento framework provides a lot of utility methods to **reduce** your work...
Jonathan Day
@Jonathan: I can appreciate your opinion. I have been down this road multiple times. The point I am making is that keeping Magento up-to-date will additional work if you code this into Magento. Even if nothing changes, when you update Magento, you are going to have to remember where all your "hacks" go and how to get them back into Magento so they work correctly. On the other hand, using something external, you are merely doing triage during upgrades. That is much less work than having to re-hack the code EVERY upgrade.
cdburgess