我如何添加更多的字段来分享愿望清单在magento



我在Magento 1.9中改变了我的共享愿望列表表单,我已经找到了我的愿望列表表单,它基本上是一个电子邮件地址框和一个消息框,我删除了电子邮件框,并放置了一个隐藏的输入表单,只发送愿望列表到一个地址,现在我试图添加姓名,地址,电话号码,邮政编码等形式,但没有看,我会尝试找到处理发送电子邮件的表单的脚本,但动作是getSendURL() ?>所以不是很有帮助,我试图改变文本区域的消息输入与消息的id,但没有运气的任何想法如何实现这一点?

<div class="page-title">
<h1><?php echo $this->__('Share Your Wishlist') ?></h1>
</div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<form action="<?php echo $this->getSendUrl() ?>" id="form-validate" method="post">
<div class="fieldset">
    <?php echo $this->getBlockHtml('formkey')?>
    <h2 class="legend"><?php echo $this->__('Sharing Information') ?></h2>
    <ul class="form-list">
        <li class="wide">
            <div class="input-box">
                <input type="hidden" name="emails" id="email_address" value="sample@gmail.com"/>
                <!--<textarea name="emails" cols="60" rows="5" id="email_address" class="validate-emails required-entry"><?php echo $this->getEnteredData('emails') ?></textarea>/-->
            </div>
        </li>
        <li class="wide">
            <label for="message"><?php echo $this->__('Message') ?></label>
            <div class="input-box">
                <textarea id="message" name="message" cols="60" rows="5"><?php echo $this->getEnteredData('message') ?></textarea>
            </div>
        </li>
        <?php if($this->helper('wishlist')->isRssAllow()): ?>
        <li class="control">
            <div class="input-box">
                <input type="checkbox" name="rss_url" id="rss_url" value="1" title="<?php echo $this->__('Check this checkbox if you want to add a link to an rss feed to your wishlist.') ?>" class="checkbox" />
            </div>
            <label for="rss_url"><?php echo $this->__('Check this checkbox if you want to add a link to an rss feed to your wishlist.') ?></label>
        </li>
        <?php endif; ?>
    </ul>
</div>
<div class="buttons-set form-buttons">
    <p class="required"><?php echo $this->__('* Required Fields') ?></p>
    <p class="back-link"><a href="<?php echo $this->getBackUrl(); ?>"><small>&laquo; </small><?php echo $this->__('Back')?></a></p>
    <button type="submit" title="<?php echo $this->__('Share Wishlist') ?>" class="button"><span><span><?php echo $this->__('Share Wishlist') ?></span></span></button>
</div>
</form>

我已经弄清楚了如何添加额外的字段到你的愿望列表表单,你需要去你的IndexController.php位于app/code/core/Mage/wishlist/controllers/IndexController.php到第627行应该是一个变量

$message = nl2br(htmlspecialchars((string) $this->getRequest()->getPost('message')));

下面添加你已经添加到你的愿望列表表单的变量,如姓名地址等。

$title =            $_POST['title'];
$first_name =       $_POST['first_name'];
$surname =          $_POST['surname'];
$email2 =           $_POST['email'];
$phone =            $_POST['phone'];
$housenamenumber =  $_POST['housenamenumber'];
$streetname =       $_POST['streetname'];
$city =             $_POST['city'];
$postcode =         $_POST['postcode'];

然后添加到第690行,找到

array(
                    'customer'       => $customer,
                    'salable'        => $wishlist->isSalable() ? 'yes' : '',
                    'items'          => $wishlistBlock,
                    'addAllLink'     => Mage::getUrl('*/shared/allcart', array('code' => $sharingCode)),
                    'viewOnSiteLink' => Mage::getUrl('*/shared/index', array('code' => $sharingCode)),
                    'message'        => $message,
                    'title'          => $title,
                    'firstname'      => $first_name,
                    'surname'        => $surname,
                    'email2'         => $email2,
                    'phone'          => $phone,
                    'housenamenumber'=> $housenamenumber,
                    'streetname'     => $streetname,
                    'city'           => $city,
                    'postcode'       => $postcode,

                )

并相应地调整它们,之后更改您的电子邮件模板并添加{{var firstname}}等,如果有任何问题,请不要犹豫,问

最新更新