I followed the tutorial at http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/installing_custom_attributes_with_your_module step by step to make my module install a couple of custom attributes, using Magento CE 1.4. I get to see the custom attributes on the product edit page, but whenever I try to save them I get an SQL error complaining that column "myattrid" does not exist. I know that:
this column is part of the flat product tables and indeed, it is not there
a lot of people give the advice to create by hand, but this bypasses the point of automatic installation
Is the tutorial I followed outdated? If so, what extra steps do I need to take?
An alternative approach is outlined in this blog post. You could try that.
I agree that you should avoid creating the attributes manually, there are many keys, indexes and relationships that Magento needs to be aware of which might be bypassed if you go straight to the database.
HTH,
JD
Related
I'm having problem with my new magento site, I want to apply a custom option to all the products on my site. Basically I want to add the custom pricing option for large sizes (my site is about motorcycle leather jackets etc), so if someone chooses a size that requires extra amount, there should be an option for that. I can apply this option to one product at a time. Does somebody know how to apply this to all products at one? Here's the link for my site: http://www.lopeholt.com
Thanks in advance.
If you want to add custom options to multiple products,same functionality is provided by following extension which could help to save your time to assign custom options to multiple products.
You can also set custom option for different sizes(large sizes).
http://www.magentocommerce.com/magento-connect/custom-option-manger.html
If you want to do this completely for free without relying on extensions you can use Magmi. It takes a little while to get used to but it allows you to import almost anything for your product database - here's the link to the Magmi tutorial:
https://understandinge.com/course/importing-products-magento/
Link to the Custom Options upload instructions:
http://wiki.magmi.org/index.php?title=Custom_Options#File_to_upload_field
There's no simple hack to do this.
However, there is a free extension to copy custom options to multiple products which could help you to save lots of work:
http://www.magentocommerce.com/magento-connect/medma-copy-delete-custom-options-on-multiple-products.html
Update: extension isn't free anymore.
I need to know if it is advisible to add new table in default database of Joomla. Will it be preserved if I update my Joomla.
If yes, then can anybody describe the steps?
Yes, you can add custom database tables if you wish, it doesn't pose any threats. Just make sure you use Joomla coding standards when getting or adding data from the table. More information on that can be found here:
http://docs.joomla.org/J2.5:Accessing_the_database_using_JDatabase
As for updating Joomla, yes, the table will be preserved.
Hope this helps
As already said, you can add any table you like to your Joomla database. Joomla doesn't care for tables it doesn't know. And those extra tables are not modified by an update.
BUT keep two things in mind:
1. If you make backups of your database with a joomla extension (such as lazyBackup) and you want to backup your extra-tables too, then make sure to include these extra tables by choosing the appropriate options in the backup extension. By default those extra table might not be included in your backup.
2. As you can easily see in phpMyAdmin all joomla tables start with a prefix such as he3ie_. This prefix is different on every joomla installation (if you did not choose your own). It is no good idea to start your extra tables with this prefix. This might collide with joomla-tables which could be created in the future (by joomla or by an extension).
as everybody said adding tables will not be affected by Joomla upgrades unless they decide to name a new table the same as yours. A table "name" could also clash with another extension that you want to install so it would be good advise to spend some time thinking on a name that will make sure is unique to your use or component.
Of course if this is a one-off custom thing then it matters less.
If you are looking for a more in-depth tutorial try this YouTube Video: http://www.youtube.com/watch?v=twT3q7dyVpI
Joomla update doesn't disturb your custom database tables or any other data. Just create the database as you want like phpmyadmin etc & use it without any fear.
I am adding regions of a country to the database in Magento so when a user selects their country a relevant list of regions will be available in a drop down menu. To do this I believe I need to add information to directory_country_region and directory_country_region_name.
The tutorial I've been looking at states that I should add them directly to the database using sql, however I remember reading that you should not place information directly into the database using raw sql when working with Magento.
My questions are:
1- to keep in line with best practices do I need to use some magento functions to add the required information to my database or can they be dropped in using raw sql?
2- if I need to use some Magento functions how do I work out which I need to use (I have heard off and noticed the lack of documentation) or is there some online reference, even if it is limited?
3- if I am not to use a sql query why is it considered bad practice to do so in Magento?
Hello, if you want to add the information just once, you can use raw sql (faster and no drawbacks), also you are right about the 2 tables (if the country is already in directory_country). If you want to make something that will be available for more Magento instalations you have to crate a new Magento module and add the sql using the installer you can read more here http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-6-magento-setup-resources
Magento wiki is a good place to start, also there are lots of blog posts.
It's considered a bad practice because Magento has its own ORM and most of the time for your new tables (entities) you only need to create models that extend magento core models and you will have access to CRUD without any development and everyone that uses your new module will understaind what's going on.
Example for a region you can use the class Mage_Directory_Model_Region or for a collection of regions Mage_Directory_Model_Resource_Region_Collection
I need to add something similar to the Review system already available on Magento. I mean, I want to add a couple of texts, reviewing capacities and alike. It should have an administration side on the backend to be able to reject/accept/edit those texts. I still do not have all the things clear so I want to ask before I embark into a wrong/closed path.
Should I reuse the existing code by copying core files into local and modifying at will?
Or should I add my own tables and link to EAV model using product ID?
On this SO question the accepted answer posts a code on how to add a new custom attribute to all products. I could use this but I would still need to add the reviews part.
I've searched for a similar functionality but can not find anything.
I'm just starting out on a component for Joomla. I can't figure out how to add an entry in the dB so I can access the component.
I looked at the dB table for components, but some of the columns seem to require some specific info.
This is NOT a finished component, but a new one I want to build.
I am using Joomla 1.7.
take care,
lee
As Jogesh_p suggested, the easy way is to create an xml file like this
http://docs.joomla.org/Components:xml_installfile
If you are just starting out with Joomla development then take a look at the Hello World tutorial.
http://docs.joomla.org/Developing_a_Model-View-Controller_%28MVC%29_Component_for_Joomla!2.5_-_Part_01
Another option to create a Joomla component quickly is to use EasyCreator, which will create the basic parts of the extension that you can then build on.