First only having an local.xml
in your theme's folder is absolutely correct, since changes on the layout should be done only by this way. So please only use local.xml to alter the layout.
As you seem to lag a lot of basic knowledge I give you an example how to find out everything you need.
First you need to find where the qty input field is defined:
Activate your template hints in the backend by ticking Sytem -> Config -> Developer -> Debug -> Template path hints
. Surf to your product detail page and you'll find your site in debug mode, showing the template file path of the blocks and some other information. For details see: http://excellencemagentoblog.com/blog/2011/09/07/magento-template-path-hints-magento/
Your qty input is inside app/design/frontend/[package]/[theme]/template/catalog/product/view/addtocart.phtml
.
If you look inside this file you'll see the qty input and that the add to cart button is directly following. As you can imagine you need to split this group apart, since you want to have other field in between.
Cut out the part for the qty input:
<?php if(!$_product->isGrouped()): ?>
<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" />
<?php endif; ?>
and save a new version of the file.
IMPORTANT
When you alter themes, make sure to create your own custom subtheme, based on the package you are using.
Get more info at: http://docs.zooextension.com/post/magento-theme-customization
Understand the part of subtheming and the theme's fallback mechanism. You only need to write new files for changes - the rest will fallback to the default theme files.
Now you need to re-add the qty input field. Create a new .phtml file (like qty-input.phtml) in a appropriate folder like: app/design/frontend/[package]/[subtheme]/template/catalog/product/view/qty-input.phtml
. Fill it with your cut out HTML snippet like:
<?php $_product = $this->getProduct(); ?>
<?php if($_product->isSaleable()): ?>
<div class="add-to-cart-qty">
<?php if(!$_product->isGrouped()): ?>
<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" />
<?php endif; ?>
</div>
<?php endif; ?>
You need to add a corresponding block as well as a call to show the block.
Copy your theme's local.xml
to you subtheme layout folder: app/design/frontend/[package]/[subtheme]/layout/local.xml
.
Find the layout node:
<action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
Before that insert a new block with your qty input phtml like:
<block type="catalog/product_view" name="product.info.addtocart.qty" as="addtocartqty" template="catalog/product/view/qty-input.phtml"/>
Probably the node isn't there. Don't panic. Just make sure the line to be added is inside the correct layout block:
<catalog_product_view>
<reference name="content">
...
<reference name="product.info">
...
<block type="catalog/product_view" name="product.info.addtocart.qty" as="addtocartqty" template="catalog/product/view/qty-input.phtml"/>
...
</reference>
...
</reference>
...
</catalog_product_view>
Finally make sure you're newly created block gets shown. Copy app/design/frontend/[package]/[theme]/template/catalog/product/view.phtml
to your corresponding subtheme's folder.
Find <?php echo $this->getTierPriceHtml() ?>
and add the following to output your input field beforehand: <?php echo $this->getChildHtml('addtocartqty') ?>
.
Some things can differ due to your theme you've bought. Try to extrapolate your new knowledge. If it comes to configurable products/bundles etc. this whole thing gets way more complicated. I guess that's the time for a new question.
Also you have to fix the CSS to make everything look nice.
Good luck!
Best Answer
is it posible to use this code in custom layout like this: