Results 1 to 2 of 2

Thread: Why doesn't Add to Cart doesn't work in an iFrame

  1. #1
    Join Date
    May 2009

    Why doesn't Add to Cart doesn't work in an iFrame

    Very very curious as to why I'm having this problem.

    My site is about 99% W3C validated. I'm trying to set up an iframe for my affiliates and I'm having a problem with the 'add to cart' function. When visiting the link itself, customers are able to add their product to the cart without any problems whatsoever in ALL browsers.

    When I put this into an iframe, the add to cart works in Firefox and Chrome, but not in IE8

    Does anyone know why this might be? I've just been using the standard <iframe src="....> </iframe>

    I tried to load it dynamically through JS, but i'm not too strong with JS.

    Any suggestions, thoughts and/or input would be great. It just doesn't make sense to me right now.

    I'm using Magento as an ecommerce solution
    Last edited by smoh; 10-19-2010 at 02:18 AM.

  2. #2
    Join Date
    May 2009
    This is what the code looks like for the add2cart function.

    PHP Code:
        <form action="<?php  echo $this->getAddToCartUrl($_product)  ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>

            <div class="product-img-box">
                <?php echo $this->getChildHtml('media'?>

            <div class="product-shop">
                <h1 class="product-name">
                    <?php echo $_helper->productAttribute($_product$this->htmlEscape($_product->getName()), 'name'?>

                <fieldset class="no-display">
                  <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
                  <input type="hidden" name="related_product" id="related-products-field" value="" />
                <?php echo $this->getChildHtml('alert_urls'?>
                <?php echo $this->getChildHtml('product_type_data'?>
                <?php echo $this->getTierPriceHtml() ?>

                <?php if (!$this->hasOptions()):?>
                    <div class="add-to-holder">
                        <?php if($_product->isSaleable()): ?>
                            <?php echo $this->getChildHtml('addtocart'?>
                            <?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
                                <span class="add-or"><?php echo $this->__('OR'?></span>
                            <?php endif; ?>
                        <?php endif; ?>
                        <?php echo $this->getChildHtml('addto'?>
                <?php else:?>
                    <?php echo $this->getChildHtml('addto'?>
                <?php endif; ?>

                <div class="divider"></div>

                <?php if ($_product->getShortDescription()):?>
                    <h4><?php echo $this->__('Quick Overview'?></h4>
                    <div class="short-description"><?php echo $_helper->productAttribute($_productnl2br($_product->getShortDescription()), 'short_description'?></div>
                <?php endif;?>

                <?php echo $this->getChildHtml('other');?>

                <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                    <?php echo $this->getChildChildHtml('container1'''truetrue?>
                <?php endif;?>

            <div class="clear"></div>
            <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                <?php echo $this->getChildChildHtml('container2'''truetrue?>
            <?php endif;?>
        <script type="text/javascript">
                var productAddToCartForm = new VarienForm('product_addtocart_form');
                productAddToCartForm.submit = function(){
                        if (this.validator.validate()) {

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center