I used MVC before. Now I am a learning HMVC.
I have product, product_category, product_description and product_images tables in my database.
I want to display list of products in my website with basic product information. Clicking on a product will redirect to a different page and will display all the product related information.
What is the best way to achieve this according to HMVC(Modular MVC) pattern?
Should I create different modules for each table like product module, product category module etc..?(In this case I will have one model class in each module/model. I found this idea when searching internet)
Should I create one module called products and put all the files related to this in that module? (In this case I will be having all the product, product_category, product_description product_images model classes under products/models)
Should I follow a completely different implementation from the techniques I've mentioned above? (Please provide specific details to build this module)
(I'm using codeignitor for my development)
Thanks a lot!
Lets simplify the things for you.
If you have category as menu (Same as magento), i will recommend you to create new module for cateogry
Coming back to product, you can manage all things with the 1 product controller.
In category, category will have its own model to interact with database.
In your product model, you can manage all kind of transactions in one model because they are part of product only.
If you want to move bit advance, you can have a sql folder in each module so that you can install the and create tables when you just drop folder to modules. For this you can create a small script where, in regular interval of time, it will check the new modules, and if that script found some new modules, it will install the .sql file in the sql folder, which will update the database schema.
Hope this will help you
Related
The product uploading feature will be automated, so all you need to do is enter a product link through the back-end itself and that then add the product photo and description during the night preferably
Please let us know its possible in Magento
IMHO, the best way to achieve that is to create a csv uploader in the backend like you can find in Mage_ImportExport_Adminhtml_ImportController (the whole module can be source of inspiration). The csv feeds a special table that you create with during your module initialization. At the end, with a cron, at the desired time you check this table for the url and then retrieve the photo and description using curl or something similar.
Side considerations :
If you have a large amount of products to inject, you will prefer direct sql queries than the slow Magento ORM
Do not forget to deactivate the indexation during import process
If you need to update and references are different between your source and your Magento, create a special attribute to be sure to have a link between both
If you feel more confortable with other framework or language and you need to create a large amount of data, the importation process can be done with any language able to interact with mysql.
So I am modifying a module and I've successfully queried the product ID. So if I am browsing products and go into the product details page, I can see my product ID using
JRequest::getInt('product_id');
but for some reason I cannot get the category ID. I've tried.
JRequest::getInt('category_id');
and it always comes out to zero no matter what category I go to. Anyone else experience this? I could get it from the nonSEF url but there's gotta be another way. My goal is to basically query the category ID when I am browsing that category or if I am in the product details of a product.
I assume, you're using some OpenCart component for Joomla. In this case, you have to look into controller and model files for OpenCart. It's not THAT easy to get certain values sometimes, because these are 2 different engines.
In short, you may have to use VQMod for OpenCart, add category_id to data array and only then JRequest it. Solely depends on task.
I am working on a custom Magento module to enter Composer information (name, bio, birth, death, etc.) and associate products (songs) with the composer. The module contains two tabs, one for the general info and the other for a list of the products (songs). The association should work exactly as the functionality of Related Products, Up-sells, and Cross-sells in the Product editing page. I feel like I've been running around in circles on a few points in regards to paging through the available songs and selecting and saving the entries. It's mainly dealing with the Grid Serialization. I've looked through as many resources as I can find, including several tutorials, without any luck:
http://magebase.com/magento-tutorials/understanding-the-grid-serializer-block/
I've posted the relevant files at this Gist and would appreciate any feedback or discussion. The files have a lot of material commented out from trying various solutions but they may prove useful in terms of thought process. Certainly available to post any other files that may be relevant.
I think this answer is exactly what you need. I know that single link answers are not very appreciated but the answer is kind of long to replicate in here.
You can also use this module creator to create you module (also available on magento connect). It has an UI that let's you create the modules in a similar way with how you create a table using phpMyAdmin. For each entity you create in your module you have the ability to say "Link many to many with products". This will create the the relation table between products and your entity and the second tab in the admin where you can choose products that are associated with your entity. Exactly like the products in the categories or like related products.
I admit that I'm the developer of the extension, but this should not be considered as spam since the extension is free and I get no profit out of it.
there are some default attributes in reviews and rating section, they are Product,Posted By,Summary Rating,Detailed Rating,Status,Nickname,Summary of Review and Review. now i want to add one more attibute named "selected size", how can i finish that ?
Reviews are not EAV entities. So extending this is somewhat easier.
1) You can add a new field in the review_detail table and extend the module to also save this new field. You will not need to do too much work at the module level (mostly the effort is to display this new field in new review form and related views).
2) You can create a new table (don't alter Magento's core db Tables) with a reference to Review (review_id) and your custom field. This also means to extend Review model's and use afterSave, afterLoad functions to save/retrieve your data...
3) Duplicate entire module logic with custom tables (I've seem some more than a few commercial extensions that have this approach to do stuff with reviews, inventory and so on). Not recommended.
you should create a module with a sql upgrade script. it's covered in tutorials by alan storm and in the database section of the videos series provided by magento, available in your account section of their site. these 2 resources both cover the rest of the skills you'll need to finish your work in accordance with magento programming practices.
In Magento 1.x review attributes are managed under >Catalog > Ratings > Manage Ratings.
In Magento 2.x they they are managed under Stores > Atrributes > Ratings.
There you will be able to add, edit or remove review attributes such Price, Quality, Value, etc.
I'm trying to develop a Magento plugin which involves using coupons. Apparently after looking around I found a source that mentions use of a 'salesrule' table for coupons. However when I looked at my database i couldn't find it. However I did find 3 tables that had mention 'coupon' called 'coupon_aggregated', 'coupon_aggregated_order', and 'coupon_aggregated_updated'.
I just wanted to know what is the difference between the 3 tables so I can start using them? I am on the latest version of Magento.
The table you're looking for is indeed named
salesrule
There's also a table named salesrule_coupon, which contains specific coupon codes linked back to the main salesrule definition.
If your database is missing this table, something bad has happened to your system. Go to
Promotions -> Shopping Cart Price Rules
and create a new coupon code with a distinct title. Then dump your database content and search for the text of your distinct title. That will let you know which table your system is storing salesrules in.
The tables you mentioned above are aggregate data tables used for reporting only.