Joomla add param to extension - joomla

I fix /administrator/components/com_content/models/forms/article.xml
with
<field name="turbobit" type="text"
label="Turbobit" description="Turbobit"
class="inputbox" size="60" />
and /administrator/components/com_content/views/article/tmpl/edit.php
with
<li><?php echo $this->form->getLabel('turbobit'); ?>
<?php echo $this->form->getInput('turbobit'); ?></li>
but when I press save this field doesn't store in database
Where I must fix code more?

in short, you need to add a column named "turbobit" in jos_content table in the database
take a look at my other answer: Add new image field to Joomla 1.7 com_content , which might be helpfull

Related

Adding additional field to registration form in Magento 1.9

i was using this tutorial to add additional field in Magento 1.9 in Registration form: http://www.fontis.com.au/blog/magento/know-more-about-your-customers-adding-custom-signup-attributes
But unfortunately it not works. I am new in Magento and need some help. I would appreciate step by step instruction on how to create new module in order to be able to add this additional field in current registration form Magento 1.9.
Ok, I just did it, here is how.
Go to http://www.silksoftware.com/magento-module-creator/ and using its Module Creator to create a new module called "YourCustomerAttribute".
Set "Add Customer Attribute" to YES
Make proper inputs and selections as you needed.
Make sure to select the forms you needed the new attributes to be used.
Generate the module.
Upload the module to your Magento folder.
Modify located at app/design/frontend/base/default/template/persistent/customer/form/register.phtml and add:
<div class="input-box">
<label for="YourAttributeName"><?php echo $this->__('YourAttributeName') ?><span class="required">*</span></label><br />
<input type="text" name="YourAttributeName" id="YourAttributeID" value="<?php echo $this->htmlEscape($this->getFormData()->getYourAttributeName()) ?>" title="<?php echo $this->__('YourAttributeName') ?>" class="required-entry input-text" />
</div>
If you want customer to be able to modify the attribute in customer panel, then modify app/design/frontend/base/default/template/customer/form/edit.phtm and add:
<li>
<label for="YourAttributeName" class="required"><em>*</em><?php echo $this->__('YourAttributeName') ?></label>
<div class="input-box">
<input type="text" name="YourAttributeName" id="YourAttributeID" value="<?php echo $this->escapeHtml($this->getCustomer()->getYourAttributeName()) ?>" title="<?php echo $this->__('YourAttributeName') ?>" class="input-text required-entry" />
</div>
</li>
Refresh all caches.
If you want to do it manually, directly via SQL because you only need a quick fix, here is how the values are stored in the DB for Magento 1.9 (might work for M2).
This is not good practice as it is a direct DB manipulation that won't work if you move your theme to another server without using the same DB. There are some use cases in which this might be warranted though ;)
Add a new entry into the 'eav_attribute' table, in this case, to have a checkbox, use
INSERT INTO `eav_attribute`
(`entity_type_id`, `attribute_code`, `attribute_model`, `backend_model`, `backend_type`, `backend_table`, `frontend_model`, `frontend_input`, `frontend_label`, `frontend_class`, `source_model`, `is_required`, `is_user_defined`, `default_value`, `is_unique`, `note`)
VALUES
( 1, 'gdpr_accept', NULL, NULL, 'int', NULL, NULL, 'select', 'GDPR', NULL, 'eav/entity_attribute_source_boolean', 1, 1, '0', 0, NULL);
This will add a checkbox entry with the name 'gdpr_accept' (to be used in the form html later) and the title 'GDPR' (will be used when referring to it).
Add a new entry to 'customer_eav_attribute', using the attribute_id of the entry you created in 1.
INSERT INTO `customer_eav_attribute`
(`attribute_id`, `is_visible`, `input_filter`, `multiline_count`, `validate_rules`, `is_system`, `sort_order`, `data_model`)
VALUES
(ATTRIBUTE_ID_FROM_1, 1, NULL, 0, NULL, 0, 100, NULL);
This will add the necessary setting to the new value.
Add a new entry to the 'customer_form_attribute' table, again with the attribute_id from 1.
INSERT INTO `customer_form_attribute`
(`form_code`, `attribute_id`)
VALUES
('customer_account_create', ATTRIBUTE_ID_FROM_1);
This will tell Magento to check for the new checkbox value when validating the registration form.
This step is the same as with the accepted answer, you can now add the checkbox to the form and it will be validated automagically by Magento:
<li class="field gdpraccept">
<div class="input-box">
<input type="checkbox" id="gdpr_accept" name="gdpr_accept" value="1"
title="<?php echo $this->__('Accept the privacy policy') ?>" class="checkbox required-entry">
</div>
<label for="is_subscribed">
<?php echo $this->__('Registering you confirm that you accept our ') ?>
<a href="<?php echo Mage::helper('cms/page')->getPageUrl( 25 ) ?>">
<?php echo $this->__('privacy policy'); ?>
</a>.
</label>
</li>
Note that in this case the id of the page with the privacy policy is 25, it will probably
be different in your case.
This was a simple checkbox case, if you want a different field, with custom validation, have a look at the 'eav_attribute' table, there you can find examples of other fields that have been added.
Or, even better, walk the recommended way and use a module like the http://www.silksoftware.com/magento-module-creator/ is creating (you can do the same thing they do in your own custom module)

Magento update product price

I am trying to customize the magento associated product dropdown menu in frontend.
So far it's working good, But i need somehow to be able to update the price when a user has clicked the radio button. I guess i need to use some jquery stuff? The price is stored in the radio value. Any suggestions? :)
The code i'm currently working with is:
<?php
if($_product->getTypeId() == "configurable"):
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product){ ?>
<input type="radio" id="attribute135" name="attribute135" value="<?php echo strip_tags(Mage::helper('core')->currency($simple_product->getPrice())) ?>" /> <?php echo $simple_product->getName();
}
endif;
?>
I ended using:
$_product->setPrice(new price value here)

attribute value added cart checkout and order page

I am using Magento Version 1.7.0.2
I have added available_color for different product color(newly added attributes) check box in product detail page.using below code
app\design\frontend\default{mytempalte}\template\catalog\product\view.phtml
<?php
$_product->getResource()->getAttribute('available_colors')->getFrontend()->getValue($_product);
$color = $_product->getAttributeText('available_colors');
?>
<h2>Item Color</h2>
<?php foreach ($color as $value): ?>
<label class="span4" style="margin-left:0px;">
<input class="pro_color_<?php echo $value; ?>" name="<?php echo $value; ?>" value="<?php echo $value; ?>" type="checkbox">
<?php echo $value; ?>
</label>
<?php endforeach; ?>
customer can able to select the multiple color .After select the product color I need to show multiple color value in cart and checkout and order page.
how to pass the color value from product detail to other page?.
Thanks
I think you should use the Custom Options feature for this instead of using an attribute.
Here is a nice screencast about custom options.
You just have to create a custom option with type checkbox and use as values you colors. The downside of this is that if you want the options for more products, you will have to manually add the option for all. Or you can search for an extension that allows one custom option for multiple products.
After adding the options, you don't have to do anything. They will be added as options to the cart.

New added attribute value pass from product detail page to cart, checkout and order

I have added new attributes to the product with multiselect option in admin.
I get the values for the selected attributes from checkbox in view.phtml (product page).
Now, I want to pass these selected checkbox values to the cart page, checkout page and order page. But I am struggling to find an easy way to do so.
Any help is greatly appreciated.
here available_colors is my attribute name
<div class="available_color span10" style="margin:10px 0;">
<?php
$_product->getResource()->getAttribute('available_colors')->getFrontend()->getValue($_product);
$color = $_product->getAttributeText('available_colors');
//print_r ($color);
?>
<h2>Item Color</h2>
<?php foreach ($color as $value): ?>
<label class="span4" style="margin-left:0px;">
<input class="pro_color_<?php echo $value; ?>" name="<?php echo $value; ?>" value="<?php echo $value; ?>" type="checkbox">
<?php echo $value; ?>
</label>
<?php endforeach; ?>
</div>
it display in product page but problem is that
when I add to product add-to-cart attribute value not pass and display in cart, checkout page.
You could use Product Custom Options to acheive this.Select the product to which you want to add custom options .You can find a tab named Custom Options.You can add the options there.
If I understand what you want, you need to store your product attribute through the quote and finally to the order.
You'll need to :
create new attribute (column) on quote and order
fill these new attributes with the user selection when adding product to quote
display it on the checkout (quote attribute value) and on the order page (order attribute value)
For the attribute creation check this link : http://www.atwix.com/magento/custom-product-attribute-quote-order-item/ .
For the display of your attribute on your pages, you just have to adapt your code to check the quote_item or order_item values.

Magento edit custom attribute from user edit screen on front end

I'm using this magento extension http://www.magentocommerce.com/magento-connect/custom-attributes-4340.html to create customer attributes. I'm able to create the attribute and view it in the backend. But I'm unable to edit/update the values when a user logins in via the front end.
This is my code on the edit.phtml page.
<li><?php $attribute = Mage::getModel('eav/config')->getAttribute('customer','height'); ?>
<label for="height"><?=$this->__('Height') ?></label>
<div class="input-box">
<input type="text" name="height" id="height" />
</div>
</li>
I haven't added anything manually to my database or created any modules. Strictly using this extension. Any help would be much appreciated.
in order to save this input in to attribute what you can do is update attribute on form submit.
1) get the value of height on the page where you submit the form. e.g $height_val
2) Now $height_val has the value so you can try this code this will update the attribute's value without saving the whole product instead.
$customer->setHeight($height_val);
$customer->getResource()->saveAttribute($customer, 'height');

Resources