Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8977971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:29:50+00:00 2026-06-15T19:29:50+00:00

I have integrated a new CMS product page for my Magento store and would

  • 0

I have integrated a new CMS product page for my Magento store and would like to use a dropdown quantity chooser for users to select how many items they would like to purchase.

So far i have the quantity chooser showing on the page but for some reason it is not functioning as intended.

1) I have set the amount of products that can be purchased to a maxinmum of 5 but the quantity chooser is showing the amount that is in the inventory (currenty set to 1000!)

2) when I select an amount that is greater than 1 only 1 product is added to the shopping basket

I have been trying to adapt and amend the code but I am unable to get it working properly. If anyone has an idea of how I should be doing this I would be grateful for a heads up!

Here’s the code:

<?php 
$category_id = "49"; // category_id for "Products"
$_productCollection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect(array('name', 'price', 'small_image', 'short_description'), 'inner')
->addCategoryFilter(Mage::getModel('catalog/category')->load($category_id));
?>
<?php if($_productCollection->count()): ?>

       <?php 
       $products = array();
       foreach ($_productCollection as $_product) { 
        ?>

    <div class="media">
          <a class="fancybox static-thumbs pull-left" href="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(500, 450); ?>" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>">
            <img class="media-object" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(150, 125); ?>" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
          </a>
    <div class="media-body span5">
       <h4 class="media-heading"><a class="view-item-button" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Order'); ?> <?php echo $this->htmlEscape($_product->getName())?><?php echo $this->__('&#8482;'); ?></a></h4>

        <p>
            <?php echo $_product->_data['short_description']; ?>
        </p>
      </div>
      </div>
      <div class="media span2"> 
        <h2 class="product-name">Price <?php echo Mage::helper('core')->currency($_product->getPrice());; ?></h2>
         <?php if($_product->isSaleable()): ?>
         <select name="qty">
            <?php $i = 1 ?>
                <?php do { ?>
                <option value="<?php echo $i?>">
            <?php echo $i?>
            <?php $i++ ?>
                </option>
            <?php } while ($i <= (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()) ?>
        </select>
        <div class="clearfix"></div>
            <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="btn btn-danger" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                <?php else: ?>
            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
        <?php endif; ?> 
        <?php } ?>
    </div>

<?php endif; ?>
<script type="text/javascript">
    $j(document).ready(function() {
        $j(".fancybox").fancybox();
    });
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:29:51+00:00Added an answer on June 15, 2026 at 7:29 pm

    If anyone gets stuck with a similar issue you need to use the following code:

    <?php 
    $category_id = "49"; // category_id for "Accessories"
    $_productCollection = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToSelect(array('name', 'price', 'small_image', 'short_description'), 'inner')
    ->addCategoryFilter(Mage::getModel('catalog/category')->load($category_id));
    ?>
    <?php if($_productCollection->count()): ?>
    
           <?php 
           $products = array();
           foreach ($_productCollection as $_product) { 
            ?>
    <form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?> class="form">
        <div class="media">
              <a class="fancybox static-thumbs pull-left" href="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(500, 450); ?>" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>">
                <img class="media-object" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(150, 125); ?>" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
              </a>
        <div class="media-body span5">
           <h4 class="media-heading"><a class="view-item-button" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Order'); ?> <?php echo $this->htmlEscape($_product->getName())?><?php echo $this->__('&#8482;'); ?></a></h4>
    
            <p>
                <?php echo $_product->_data['short_description']; ?>
            </p>
          </div>
          </div>
          <div class="media span2"> 
            <h2 class="product-name">Price <?php echo Mage::helper('core')->currency($_product->getPrice());; ?></h2>
             <?php if($_product->isSaleable()): ?>
       <select name="qty">
      <?php $i = 1 ?>
      <?php do { ?>
        <option value="<?php echo $i?>">
          <?php echo $i?>
          <?php $i++ ?>
        </option>
        <?php } while ($i <= (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMaxSaleQty()) ?>
    </select>
            <div class="clearfix"></div>
                <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="btn btn-danger" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                    <?php else: ?>
                <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
            <?php endif; ?> 
            <?php } ?>
    
        </div>
    </div>
    <?php endif; ?>
    <hr />
    <script type="text/javascript">
        $j(document).ready(function() {
            $j(".fancybox").fancybox();
        });
    </script>
    
     <script type="text/javascript">
        //<![CDATA[
            var productAddToCartForm = new VarienForm('product_addtocart_form');
            productAddToCartForm.submit = function(button, url) {
                if (this.validator.validate()) {
                    var form = this.form;
                    var oldUrl = form.action;
    
                    if (url) {
                       form.action = url;
                    }
                    var e = null;
                    try {
                        this.form.submit();
                    } catch (e) {
                    }
                    this.form.action = oldUrl;
                    if (e) {
                        throw e;
                    }
    
                    if (button && button != 'undefined') {
                        button.disabled = true;
                    }
                }
            }.bind(productAddToCartForm);
    
            productAddToCartForm.submitLight = function(button, url){
                if(this.validator) {
                    var nv = Validation.methods;
                    delete Validation.methods['required-entry'];
                    delete Validation.methods['validate-one-required'];
                    delete Validation.methods['validate-one-required-by-name'];
                    if (this.validator.validate()) {
                        if (url) {
                            this.form.action = url;
                        }
                        this.form.submit();
                    }
                    Object.extend(Validation.methods, nv);
                }
            }.bind(productAddToCartForm);
        //]]>
        </script>
    

    Be sure to add a multipart form and the javascript!!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have integrated a Custom Google Search on a new site I am working
I am new to the iPhone Programming. I have integrated facebook into my application
I would like to allow users to log in into my website with OpenID.
i have been working on a new .net MVC site and have integrated some
I have integrated yii bootstrap extension in to my site. I have a page
I have integrated Like button and Comments plugin in my website. Recently some of
i have integrated in my system an external script to allow my users to
I have this in a public class: SqlConnection myConnection = new SqlConnection(Data Source=hermes;database=qcvalues; Integrated
I have integrated the new google maps api v2 fragment in a view pager.
I have the store procedure for validating user id and password like this PROCEDURE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.