views:

168

answers:

3

Magento - Module VS Dataflow

I am consider the possibility of ---- using Magento DataFlow to extract information from db to tie in with a video CMS.

It could save development time - or it might not.

It could be more stable - or it might not.

The question becomes is it better to tightly integrate the video system to magneto as module that does not hack core ---- or to query db directly - freeing up ability to work outside of magneto core but still interact with it?

I have to decide if it is better from a development point of view and from a functional / day to day use / maintenance point of view

--

UPDATE ONE:

"it's unclear from your post where this data will end up or whether you're writing to the database, etc"

if done in Magento as module, the videos and playlists will be configured in admin.

it will be a sort of "media configurator" that can take in multi-protocol sources (e.g. http://erlyvideo.org/files, aws cloudfront, wowza, any server, brightcove, youtube. etc) and spit out / configure code blocks (e.g. flash, html5 video, js, php). this will be done by pasting in code / urls and/or uploading content.

--

if not done in Magento the same type of thing will take place in another CMS (custom or something like drupal or wordpress)

--

i dont know for sure every possible interaction that would have to take place but - in the media gallery - there is a favorites system, saved sessions, user group permissions, subscribe to content (vod).

single video instances will also be served on store page and blog: but the interaction would be limited to only serving the video.


UPDATE TWO:

"What purpose does Magento serve in this scenario?"

As far as I can presently tell, saved sessions (any user), a favorites system (logged in user), saved preferences (logged in user), user group permissions (any user or logged in user + with various user types).

But other than VOD instances, the purpose of the media gallery is:

A. offering free video clips.

B. to let users see trailers of the clients DVD products.

Neither seem, in and of themselves, to require much interaction. But for the sake of continuity, it might be better to keep everything in one db configured from one admin- regardless of if it is more tightly integrated out of necessity or for convenience.

But as originally stated, maybe something more robust/versatile or simply more stable by its independence would be achievable outside of db/store. Maybe the latter being promoted by those who really don't understand Magento or have some limits to their understanding and therefore counsel towards separation. I don't know.

--

"Unless the videos are related to products, there's no reason to tag them to products."

That makes sense for trailers and free videos as just mentioned. I suppose a possible exception being a VOD video or VOD group of videos. In that case, I assume you are saying that it might be better for the video to be a specially configured product that, among other things, happens to also appear in media gallery?

In that case, VOD, the video clip itself (or its container) would be a product. It could be previewed and bought and placed anywhere as needed- in addition to have its own product page (if needed). How that is "made" from a code perspective is the question.

Another possibly different approach would be like this one: (page is gone) http://workbookproject.com/newbreed/2010/06/21/build-your-own-vod-portal/ try this: http://filmutopia.typepad.com/lone_gun_manifesto/2010/07/how-to-build-your-own-vod-portal-in-a-matter-of-hours-for-less-than-100-lgm.html. Where a user is actually buying access to a page.

Zac did a great job on his site and in the article, and I could see this kind of thing being done with Magento, but as Zak points out at the end of his article, he is using Flash, so my solution would go further and deliver in HTML5 Video and/or [any protocol].

So i don't know if Magneto would be overly cumbersome to get into this kind of thing VS using WP like Zak did, or something else.

--

"It's possible to create regular data models in Magento to wrap database calls, and if there is no interaction between videos and products, creating one of those models should do the trick more cleanly."

OK I read up on "data models in Magento" but I don't see what they pertain to / physically consist of - in the schema of this spec.

Clearly many ways to do things in Magento.

DataFlow, data models, Magento Modules...heck...why not toss in Widgets?? :)

--

Any more opinion on this? much appreciated.

+1  A: 

I'm not sure that Dataflow is the answer. Dataflow is more like a cron import/export, which would be great for mass updates, exporting to something like an ERP, and so on - if you're looking for live data, you're going to need to hook into the API and draw out the information you need, which seems much more practical, and it is real-time. Your time investment isn't too ridiculous as far as development times, either.

melee
"hook into the API and draw out the information you need" might be closer than dataflow since it is "live". i will look closer at the API
jon
+1  A: 

For the most part, staying inside of the framework (as opposed to hacking the DB) is your best bet from a headache perspective. If you can, create a module that handles the interaction and consume that at will (it's unclear from your post where this data will end up or whether you're writing to the database, etc).

The exception to using the framework comes when performance is key, such as when you have thousands or tens of thousands of records to pull. In that case, grabbing from (and writing to) the database is sometimes the only feasible option.

Hope that helps!

Thanks, Joe


Ignoring the other features (such as comments, favorites, etc. look up Alan Storm's tutorials on saving data in the database for those), keeping videos as products can be accomplished using attributes themselves, in which case all the data can stay in Magento (saved in admin, displayed on frontend). That way, the catalog object will mediate with the database for you, saving you lots of pain.

Either way, there don't appear to be any scaling problems here at the moment, so using the framework (Product objects for the main info, create your own objects for favorites and such) should be a good way to accomplish this.


Actually, I'm getting a little turned around here. What purpose does Magento serve in this scenario? Unless the videos are related to products, there's no reason to tag them to products. It's possible to create regular data models in Magento to wrap database calls, and if there is no interaction between videos and products, creating one of those models should do the trick more cleanly.

Joseph Mastey
"it's unclear from your post where this data will end up or whether you're writing to the database, etc" see "update" above
jon
"keeping videos as products can be accomplished using attributes themselves" are you saying each video would be a product and no additional magento module would need to be written for videos?
jon
"What purpose does Magento serve in this scenario?" UPDATE TWO: above
jon
+1  A: 

As a general rule, I would strongly suggest writing a module. DataFlow can be a little opaque, and is designed (as stated already) for batch transfers of data, not real-time "transactional" querying which I think is what you're asking for.

Writing directly to the database will bypass all the inbuilt business and data layer logic that exists in Magento for good reasons - e.g. updating indexes for performance, checking ACLs, etc. So you should use the Mage::getModel('module/model') approach for your development. It will also provide you with a lot of convenience methods for selecting, filtering, manipulating objects.

If you write your own module, you will be much more able to understand what is happening, to debug your code and observe the effect of changes. Using the moduleCreator will give you a great headstart on that.

When you write your module, I suggest you follow Joseph's suggestion to add your information as attributes to the related products. This blog post walks you through the process.

Good luck! JD

Jonathan Day
great points and makes sense. I wonder how that thinking would change with these arguments tossed in. 1. building highly integrated solutions will require more maintenance because they will "break" and "break" magento every upgrade. 2. since mobile versions of site have to be considered, if using something like Sencha Touch to create webapp of site, would it be easier/better overall to feed ST -from- the full and complete magento (with proposed modules) or keeping an independent CMS that interacts with the ST webapp and Magneto.
jon
Good questions. 1. The Magento module system is quite decoupled, so that will reduce your risk of breakage from upgrades, and I'd suggest that DataFlow is more likely to have changes applied with less attention paid to backwards-compatibility. The Varien/Magento team wouldn't be expecting developers to hang customer-facing functionality on DataFlow. 2. I don't have any experience with Sencha Touch (looks good BTW) but as a general principle, the less moving parts in that sort of integration the better. I'd recommend using Magento as your CMS if you can.
Jonathan Day
with " Magento as CMS " any thoughts on how to best supply data to ST from magneto? the question was asked of ST team and they said: http://www.sencha.com/forum/showthread.php?107792-Plays-well-with-others
jon
Hah, sounds like you need a REST server for Magento. I'm about to start on a new project to create exactly that. Currently, the external API is only available via SOAP (and fairly slow and buggy by all reports), however AMF interfaces (using Zend_AMF) have been created previously. Serialising REST as JSON is fairly trivial as there are translation libraries available, but creating an extensive customer-facing REST implementation is a big job. You are effectively re-writing all the code from the `app/design/frontend/` phtmls to output XML rather than XHTML. Take a deep breath!
Jonathan Day
do you happen to know of any sites that have this in place already (or something similar)
jon
is this anything like what you outlined in terms of the methodology behind the interactivity of the plug-in? http://mysillypointofview.richardferaro.com/2010/05/11/mage-enabler/or thishttp://mysillypointofview.richardferaro.com/2010/07/03/how-to-add-magento-blocks-css-and-javascript-to-an-external-site/
jon