直接在事件中添加item,无弹窗 addGiftRegistry()

add item directly in the event, no pop ups addGiftRegistry ()

我正在开发一个礼物列表,当我有多个事件时,会打开一个弹出窗口 select 该事件并将项目添加到单击时选择的列表中。但是因为我只有一个事件我想直接添加项目而不弹出,只是我无法将项目移动到列表中,有人可以帮我解决这部分吗?

<div id="adjgiftreg_popup" style='display: none;'>
    <div class='box base-mini'>
        <div class='head'>
            <h4><?php echo $this->helper('adjgiftreg')->__('Add to Registry') ?></h4>
            <div class="btn-close">
                <a href="#" onclick="$('adjgiftreg_popup').hide(); return false;"><img src="<?php echo $this->getSkinUrl('images/btn_window_close.gif') ?>" alt="<?php echo $this->__('Close') ?>" /></a>
            </div> 
        </div>
        <div class='content'>
            <p>
                <?php //sends to the function ?>
            <?php foreach ($this->getEvents() as $event): ?>
            <a href="#" onclick="return addToGiftRegistry(<?php echo $event->getId()?>)"><?php echo $this->htmlEscape($event->getFullTitle())?></a>
            <br/>
            <?php endforeach ?>
            </p>
        </div>
    </div>
</div> 


<script>
var baseRegistryLink = '';

function showRegistries(link){
    baseRegistryLink = link;
<?php if ($this->getEvents()->count() > 1): ?>
    $('adjgiftreg_popup').show();
<?php else: ?>
    addToGiftRegistry(0);
<?php endif ?>
    return false;
}
//function parameter receives and verifies number of events

function addToGiftRegistry(e){
    baseRegistryLink = baseRegistryLink + 'event/' + e;
    var form = $('product_addtocart_form');
    var oldFormLink = form.action;
    if (form){
        form.action = baseRegistryLink;
        if(!productAddToCartForm.submit()) {
            form.action = oldFormLink;
        }
    }
    else{
        document.location.href = baseRegistryLink;
       }

    return false;
}

</script>

注意:工作人员不知道你能否很好地表达我的疑问,因为我的英语很糟糕,但我希望有人能帮助我和intenda,谢谢!

通过此更改获得了一些结果。

function showRegistries(link) {

    baseRegistryLink = link;

    <?php if ($this->getEvents()->count() > 1): ?>
    $('adjgiftreg_popup').show();
    <?php else: ?>

    <?php foreach ($this->getEvents() as $event): ?>
        addToGiftRegistry(<?php echo $event->getId()?>);
    <?php endforeach ?>

    <?php endif ?>

    return false;

}

如果有人有任何改进的建议,谢谢。