可配置的产品选项不会从第二次出现在彩盒上

时间:2014-02-07 07:28:49

标签: jquery ajax magento colorbox

现在我正在开发一个项目,我需要在弹出窗口中显示可配置的产品选项,这是一个彩盒。

Its working fine with simple products.但是如果是product is configurable then the options are not showing。当我尝试load the page for first time then its working时。但是来自second time whenever i trying to reload the page the options are not coming anymore.

现在我使用.live功能在quickview上进行实时点击。 If i remove the function then options are showing.但我无法移除实时功能。

这是实时功能

jQ(document).ready(function(){  jQ(".link-shoppinglist").live('click', function() {   
 jQ.colorbox({   href:jQ(this).attr('href')   }); 
 //parent.jQuery.fancybox.hide();
  return false; 
 }); 
 });

这是弹出窗口的代码

<?php

$_customer = Mage::getSingleton('customer/session')->getCustomer();
$NameOfListName = array();
$groupsCont  = Mage::getModel('shoppinglist/group')->getGroupByCustomer($_customer->getId());
$i = 1;
foreach($groupsCont as $mylist) {
    $lData = $mylist->getData();
    $NameOfListName[$i] = $lData['list_name'];
    $i = $i+1; 
}
$createdList = count($groupsCont);
//echo '<pre>'; print_r($NameOfListName); echo '</pre>'; ?>





<?php if(Mage::getSingleton('customer/session')->isLoggedIn()):?>
  <?php $_product = $this->getProduct() ?>
  <form action="javascript:submitAddItem();" method="post" id="form-add-item">
    <div class="form-add">
      <h2 class="legend"><?php echo $this->__('Add item to shopping list') ?></h2>
      <ul class="form-list">
        <li class="fields">
          <div class="field">
            <?php //echo $this->getPriceHtml($_product);?>
          </div>
        </li>
        <li class="fields">
          <div class="field">
            <div class="pro-shop">
              <h5 id="product_name" class="product_name"><?php echo $_product->getName() ?></h5>
            </div>
            <?php if ($_product->isSaleable()):?>
            <?php echo Mage::helper('shoppinglist')->getProductOptionsHtml($_product);?>
            <?php endif;?>
          </div>
        </li>
        <li class="fields">
          <div class="field">
            <label class="required"><em>*</em><?php echo $this->__('Choose a shopping list')?></label>  
            <?php echo Mage::helper('shoppinglist/group')->getGroupHtmlSelect($_customer->getId(), null, null, true); ?>
          </div>    
        </li>
        <?php if($createdList <= 4 ) { ?>
        <li class="control">
          <input type="checkbox" name="create_group" id="create_group" value="1" onclick="setCreateGroup(this.checked)" title="<?php echo $this->__('Create New List') ?>" class="checkbox" /><label for="create_group"><?php echo $this->__('Create New List') ?></label>
        </li>
        <?php } ?>
        <li>
          <div id="form-create-group" style='display:none'>
            <label for="group-name" class="required"><em>*</em><?php echo Mage::helper('shoppinglist')->__('List Name') ?></label>
            <div class="input-box">

            <select name="group-name" id="group-name"  title="<?php echo Mage::helper('shoppinglist')->__('List Name') ?>" value="">

                    <option value='Monthly List 1' <?php if(array_search('Monthly List 1',$NameOfListName)) echo 'disabled'; ?>>Monthly List 1</option>
                    <option value='Monthly List 2' <?php if(array_search('Monthly List 2',$NameOfListName)) echo 'disabled'; ?>>Monthly List 2</option>
                    <option value='Weekly List 1'  <?php if(array_search('Weekly List 1',$NameOfListName)) echo 'disabled'; ?>>Weekly List 1</option>
                    <option value='Weekly List 2'  <?php if(array_search('Weekly List 2',$NameOfListName)) echo 'disabled'; ?>>Weekly List 2</option>
                </select>
              <!--input name="group-name" id="group-name" title="<?php echo Mage::helper('shoppinglist')->__('List Name') ?>" value="" class="input-text required-entry" type="text" /-->
            </div>
          </div>
        </li>
        <li>
          <div class="field">
            <input name="customer_id" id="customer_id" type="hidden" value="<?php echo $_customer->getId()?>">
            <input name="product_id" id="product_id" type="hidden" value="<?php echo $_product->getId() ?>">
            <input name="product_type_id" id="product_type_id" type="hidden" value="<?php echo $_product->getTypeId() ?>">
          </div>
        </li>
      </ul>
      <?php //echo $_product->getTypeId() ?>
      <div class="buttons-set">
        <p class="required"><?php echo $this->__('* Required Fields'); ?></p>
        <button class="button btn-submit right" id="btn-submit-add-item" title="<?php echo $this->__('Submit')?>" type="submit">
          <span><span><?php echo $this->__('Submit')?></span></span>
        </button>
        <button onclick="javascript:resetFields();" class="button btn-reset right" id="btn-reset" title="<?php echo $this->__('Reset')?>" type="button">
          <span><span><?php echo $this->__('Reset')?></span></span>
        </button>
      </div>
    </div>
  </form>
  <?php else:?>
  <?php endif?>
<script type="text/javascript">
  //<![CDATA[
  var formAdd = new VarienForm('form-add-item', false);
  function resetFields() {
    Form.reset('form-add-item');
  }
</script>   

Any help will be appreciated.

0 个答案:

没有答案