Magento backend - make the price field readonly - magento

I want to make the price text field in magento backend readonly because I use another custom attributes to fix prices.
How can I do that ?
Thanks a lot.

You need create an observer for catalog_product_load_after with the code like this:
$product->setLockedAttributes(array('price'));
And your product edit form will have readonly price field.

Since this would make attributes very silly, I don't believe that there is any simple mechanism by which to do this. One easy hack that you could use for this would be to add a JS file to that page which disables the price field specifically. Use the XML layout files for the default adminhtml package to add that JS file.
Hope that helps!
Thanks,
Joe

Related

joomla using virtuemart i want the description to be placed under products

I have a joomla site using virtue mart in my products. I want my description to be placed under the products. Any help would be appreciated.
You will see here that the description is above the products.
I have had a look through the source files but was wondering the best way to go about this as I may just be missing something.
I hope you are using , VM2.x Versions.
The the Product Details Page Source file you can found on the following path.
components\com_virtuemart\views\productdetails\tmpl\
The product description and short descriptions are included in the default.php layout.
If you want to change the description ordering simply change its position as per your requirement.
$this->product->product_s_desc and $this->product->product_desc;
If you are planning to change the default VM template style , I recommend to use Joomla Override Concept this way you can simply override the default template with your own.
Here you need to override productdetails view then simply like below.
copy all the files from components\com_virtuemart\views\productdetails\tmpl\ and paste this to , templates/your_template/html/com_virtuemart/productdetails/ If you unable to find this path inside your template folder you have to create that.
This will simply load your new layouts from template folder rather than default path.
Hope it clear for you..
The VM Template system also lets you create additional view templates for categories and products. To override the default categories, category, or productdetails view, simple use the standard Joomla template override method. Copy /components/com_virtuemart/views/[categories, category, or productdetails]/default.php to /templates/[Your Template]/html/com_virtuemart/[categories, category, or productdetails]/default.php and make your changes to the template version of default.php.
To create additional views that can be set on a per category/product basis, simply copy /templates/[Your Template]/html/[categories, category, or productdetails]/default.php to a new file name like /templates/[Your Template]/html/[categories, category, or productdetails]/myView.php and make the desired changes. In the Virtuemart category or product configuration, you will find myView in the drop down list of alternatives views that can be used.

How do I add product short description on the product list template page on Magento?

I want to add product short description to product list template page, and I found this article:
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-3-magento-controller-dispatch
it said: Blocks refer directly back to the models for their data. In other words, the Action Controller does not pass them a data structure.
So , does it mean the code to get short description should be added to the Block class? But the Block class is Magento Core class:
Mage_Catalog_Block_Product_List
I should not edit this class, right? So what should I do? Create my own Block class extend Mage_Catalog_Block_Product_List and add the showProductShortDescription method to it? If yes, Should I create my own module?
Thank you!
You can use in the list.phtml file this.
$_product->getShortDescription();
but Magento does not load all the attributes on the product listing page.
Go to the admin pannel Catalog->Attributes-> Manage Attributes and edit the short description attribute.
Set “Used in product listing” to “Yes”. Save and clear the cache.

how to add default variants to product in magento

I'm very new to Magento.I am having product with some variants like "size" with values "large XX,small XX,medium XX".I want the feature to make any one of this values as default in admin.
my screenshot explanation here
How can i do this
please help me!
When you say you want them to be defaults, you are being a little vague. Are you talking about using configurable products for this? Custom product options? When you say "default in admin", what do you mean? Which page are you referring to? More detail will help us answer the question.
Thanks,
Joe
As far as I know, what you are asking for is not a default functionality of Magento, but it shouldn't be difficult to add some javascript to allow you to force selections at page load time. Ultimately, it's just code, so it's definitely possible to do.
my suggestion would be to add a attribute to all you products called for instance "defaultselect" then you can enter your value easily from the backend to your configurable product.
so now you have a configurable product say a hat which comes in 3 sizes, and has 3 assigned simple products. set the defaultselect value to one of the size values
now some layout xml and javascript is required to get you product attribute to work with the magento selects.
first you want to actually include you js. this is done through the layout xml. you can include update using add js method for PRODUCT_TYPE_configurable handle
now the js. store the js in the skin js folder.
to make this work you would need to know the configurable product defaultselect attribute value we're testing against. this could be retrieved with your own ajax function to a method which checks if the current product has a defaultselect attribute and returns it's value or false.
if you have a value from your ajax function you can work with that ie you have both the returned attributes from the configurable product and magento will return the rest.
however after that it seems to get complicated your going to have to do something with the js magento aready uses to render product options

magento - adding a new attribute to existing attribute sets which already contain configurable products

I need to add an attribute to an existing set of products which are already within an attribute set. When I go into the product after adding the neww attribute to the attribute set I can't see it in the product edit page?
Is there any way to do this? maybe at database level? or an I missing something?
Any help would be greatly appreciated,
Dave
edit - sorry forgot to mention these are configurable products that the new attribute isn't working on
This should work fine. What you might want to try is changing the group that the attribute is in, from prices to description and then see if it shows up on the description pane.
Did you reindex your Data?
System -> Index Management

add attribute in product information -> Inventory tab

Hey, I just realise how easy is to add attributes to the form products in ADMIN, and its working perfectly.
So similarly to setting attributes for General, Prices, Meta Information, Images, Recurring Profiles, Design and More Information, how can I add an attribute to Inventory form?
Thanks in advance for any help.
Unfortunately, the Inventory form is not dynamic like others, and you can't just add an attribute to this form.
If you are good with Magento programming, than you can play with it's block:
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php
and with it's template:
app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml
For me (in Magento v 1.3.2.4) creating attributes the usual way (Catalog>Attributes>Manage Attributes) didn’t work in this case, as the value for that attribute didn’t get saved. In order to be able to save it I had to create this attribute in database table ”cataloginventory_stock_item”.
Only then the value is saved for each product.

Resources