Magento - Change quantity label text to hours and have a dropdown - magento

Need help on how to change the label "quantity" to "hours" and have a drop down. I have tier pricing on that particular product. I need to replace the text "quantity" to hours on that particular product alone. Help required. Thanks in advance.

To change label navigate to Backend > catalog > attribute > manage attribute Search for your targeted attribute. And edit on the left side on attribute information section > Manage Label/options and there you will find titles section and change the label.
Regarding changing attribute type to dropdown from Catalog Input Type for Store Owner once you assign and save an attribute you cannot change there after.
Edit
To change for only one product check for it and if is true print other label.
$_product->getAttributeText('quantity')

You can do it programatically in this way:
Add a custom phtml file for addtocart part under: app/design/frontend/[your_template_package_name]/[your_template_name]/template/catalog/product/view/addtocart_custom.phtml
with this content:
<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if($_product->isSaleable()): ?>
<div class="add-to-cart">
<?php if(!$_product->isGrouped()): ?>
<label for="qty"><?php echo $this->__('Hours:') ?></label>
<select class="input-text qty" name="qty" id="qty">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<?php endif; ?>
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
<?php echo $this->getChildHtml('', true, true) ?>
</div>
<?php endif; ?>
Add on your product page in Magento admin the following layout update under Product details->Design->Custom layout update:
<reference name="product.info.addtocart">
<action method="setTemplate"><template>catalog/product/view/addtocart_custom.phtml</template></action>
</reference>

in my case (magento ce 1.9.2) the path to addtocart.phtml is:
app/design/frontend/YOURTEMPLATE/default/template/catalog/product/view
replace the word "Quantity" with your word(s) in a line (in my case - line# 32) that starts with:
<label for="qty">
gl,
H

Related

Magento Save Value in Custom Attribute of Customer from one page checkout (billing.phtml)

I have made one attribute for customer registration. It is working fine on registration. I am getting problem on one page checkout. Like normal registration, i am also taking value from customer during one step checkout registration but problem is that it doesn't store the value in attribute. thank you in advance
code of billing.phtml which display textbox for attribute to take value from user
<li class="fields">
<div class="field">
<label for="<?php echo $attribute->getAttributeCode(); ?>" <?php if($attribute->getIsRequired()):?>class="required"><em>*</em> <?php else :?>><?php endif;?><?php echo $this->__($frontEndLabel) ?></label>
<div class="input-box">
<?php if($attribute->getFrontendInput()== 'text'):?>
<input type="text" name="billing[test]" id="billing:<?php echo $attribute->getAttributeCode(); ?>" title="<?php echo $this->__($frontEndLabel); ?>" class="input-text <?php echo $fieldRequiredClass; ?> <?php echo $fieldFrontendClass ;?>" />
<?php endif ?>
</div>
</div>
<?php endif ?>
<?php endforeach ?>
</li>
Just Update following code in your config.xml and check it
<fieldsets>
<checkout_onepage_quote>
<attributename>
<to_customer>*</to_customer>
</attributename>
</checkout_onepage_quote>
</fieldsets>

Hide Bundle Items in Magento

I'm looking for help with a rather frustrating Magento issue I can't seem to get my head around.
On our Magento site we have several Bundled Products. These work fine etc but all the items of the Bundled Product are displayed on the page; it makes the page unnecessarily long & the list isn't need as the items are fixed, customers can not change or edit any of the items.
Ideally what I would like to do is stop those items being displayed so it looks more like a normal product page.
I have tried editing the view.phtml file located in:
app/design/frontend/default/my_theme/template/catalog/product/
I found the following blocks of code:
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
<?php endif;?>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>
When the 'container2' lines are removed, it does remove the list of bundled items but also removes the 'Add to cart' button too.
Would appreciate any help on this as I haven't been able to resolve this issue using Google Sensei.
Step:1 First Remove below Lines from --template\catalog\product\view.phtml
if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif; ?>
Step2: Add Below Lines inplace of Above lines
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('catalog/product/view/addtocart.phtml')->toHtml(); ?>
Step3: --template\catalog\product\view\addtocart.phtml
Remove All Lines from file and add below code
<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<div class="add-to-cart">
<?php ?>
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<!--<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>-->
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button></p>
<?php echo $this->getChildHtml('', true, true) ?>
</div>
Step4: - Go to admin panel, Go to products and if custom Options are marked as required mark them as not required.
See this screen shot for more info
Thanks...
Although this is a very old issue, but thought this might be useful for someone who runs into the requirement.
All you would want to do is, edit the .phtml file which renders the Bundle items.
This is how I solved it:
Usually the file you would want to edit would be:
YOUR_THEME->default->template->bundle->catalog->product->view->type->bundle->option->select.phtml
If you cant find this path in your theme, then:
Step1) Turn on Template hint from System->Configuration. Click on Developer, and under Debug tab, Enable the Template hint.
Step 2) Refresh or go to the product view page, where your bundle items are listed, locate the file through template hint.
Once you are in select.phtml file, you can do whatever you want to hide or display or change the code. I just added a div with "display:none" style, and it hid the whole "Bundle Item" block.

Add field to Edit Account form in Magento

I'm adding a field to the template customer/form/edit.phtml. I used this code :
<li>
<?php
$attribute = Mage::getModel('eav/config')->getAttribute('customer','code_magique');
?>
<label for="code_magique" class="<?php if($attribute->getIsRequired() == true){?>required<?php } ?>"><?php if($attribute->getIsRequired() == true){?><em>*</em><?php } ?><?php echo $this->__('Code') ?></label>
<div class="input-box">
<input type="text" name="code_magique" id="code_magique" value="<?php echo $this->htmlEscape($this->getCustomer()->getData("code_magique")) ?>" title="<?php echo $this->__('Code') ?>" class="input-text" />
</div>
</li>
This display a field with my "code_magique" attribute inside but when i try to modify this attribute, it doesn't work, did I forget something?
I did a quick look at AccountController.php, and it seems there is some postprocessing of form data, not the simple $model->addData($post);
Try hooking to customer_save_before event and adding your data manually.
Hopefully you know how to create anobserver and add data to model object?

create select in joomla

I have a little confused with joomla 2.5
I have a component (product) with name, description and category.
I want to do a select to find a product selecting the category...
In the view of the front-end I show all the product, and I put a select here
<?php echo JHTML::_('select.genericlist', $options,'myfilter', 'class="inputbox"','value','text'); ?>
<?php if($this->items) : ?>
<div class="items">
<ul class="items_list">
<?php foreach ($this->items as $item) :?>
<li><?php echo $item->nombre; ?></li>
<li><?php echo $item->descripcion; ?></li>
<li><?php echo $item->nivel; ?></li>
<?php endforeach; ?>
but I don´t know how to call the controller and model if I select one item of select
You would need to:
Wrap your <select> with a <form> tag
replace first line of your code with:
< ?php echo JHTML::_('select.genericlist', $options, 'myfilter', 'class="inputbox" onchange="this.form.submit()"' ,'value', 'text'); ?>
Write your Controller and Model. A good tutorial can be found at:
http://docs.joomla.org/Developing_a_Model-View-Controller_Component/2.5/Introduction
set appropriate parameters in order to point joomla to the right controller. eg:
<input type="hidden" name="option" value="com_helloworld" />
<input type="hidden" name="task" value="updhelloworld.submit" />

Magento Add Country Attribute to Customer Address Entity

I need to add new fields like street,country in the account registration page.How do I add another country field without conflicting existing one.I tried the following,but the selected country doesn't show up in admin.
<div class="field">
<label for="country2" class="required"><em>*</em><?php echo $this->__('Country 2') ?></label>
<div class="input-box">
<?php
$_countries = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false) ?>
<?php if (count($_countries) > 0): ?>
<select name='trading2_country' id='trading2_country'>
<option value=''>– Please Select –</option>
<?php foreach($_countries as $_country): ?>
<option value='<?php echo $_country['value'] ?>'><?php echo $_country['label'] ?></option>
<?php endforeach; ?>
</select>
<?php endif; ?>
</div>
</div>

Resources