Kriuchko
1/9/2019 - 11:43 AM

Email to a friend

Magento 1 email to a friend send email form email form popup template pop-up template send to a friend

В админке так же надо включить что бы могли отсылать и гости без логина

<reference name="product.info">
  <block type="sendfriend/send" name="sendfriend.send" template="sendfriend/send.phtml" />
</reference>

First, open app\design\frontend\{template}\default\layout\sendfriend.xml and replace

<action method="setTemplate"><template>page/2columns-right.phtml</template></action>

to

<action method="setTemplate"><template>page/popup.phtml</template></action>

Second, include/copy jquery lightbox dependency files to js/css folder, also, app\design\frontend\{template}\default\layout\page.xml - addJs and addCss

Third, open and edit

<?php if ($this->canEmailToFriend(): ?>
     <?php if ($this->helper('customer')->isLoggedIn()): ?>
          <p class="email-friend"><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>" rel="lightbox" class="lightbox"><?php echo $this->__('Email to a Friend') ?></a></p>
     <?php else: ?>
          <p class="email-friend"><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a></p>
     <?php endif; ?>
<?php endif; ?>

just replace the “rel” or “class” or whatever lightbox needed to work.

I included isLoggedIn because if user is not logged in, it will redirect to login page or else you need to remove it from admin to allow guest to use this function. 


*******************************

>> Move email to friend form to product details page ::

1. Go to admin=>system=>configuration=>Email To Friend and change "Limit Sending By" cookie to IP.
And change "Allow for Guests" to Yes.

2. Add to catalog.xml layout (in content):
<block type="sendfriend/send" name="sendfriend.send" template="sendfriend/send.phtml" />

3. Add to view.phtml template page:
<?php echo $this->getChildHtml('sendfriend.send');?>

4. In Mage_Sendfriend_Block_Send block row159
       replace the method :
public function getSendUrl()
{
  return Mage::getUrl('*/*/sendmail', array(
      'id'     => $this->getProductId(),
      'cat_id' => $this->getCategoryId()
  ));
}

        with...
public function getSendUrl()
{
  return Mage::getUrl('sendfriend/product/sendmail', array(
      'id'     => $this->getProductId(),
      'cat_id' => $this->getCategoryId()
  ));
}