List of Methods
Global Methods
-
getUnsubscribeUrl - a direct link to unsubscribe from current trigger
Customer will be unsubscribed from all already scheduled emails (Follow Up Email > Mail Log (Queue)) for current trigger.
This link not unsubscribe customer from future emails (triggered by another events) or native magento subscription.
Usage:
<a href="<?php echo $this->getUnsubscribeUrl() ?>">Unsubscribe</a>
Additional you can specify a target URL as the parameter to this method to which customer will be redirected after unsubscription:
<a href="<?php echo $this->getUnsubscribeUrl($this->helper('cms/page')->getPageUrl(10)) ?>">Unsubscribe</a>
I.e. customer will be redirected to the CMS page with ID 10.
You can subscribe customer back, follow subscribe instruction for this.
-
getUnsubscribeAllUrl - a direct link to unsubscribe from all triggers
Customer will be unsubscribed from all already scheduled emails (Follow Up Email > Mail Log (Queue)) for all triggers.
This link not unsubscribe customer from native magento subscription.
Usage:
<a href="<?php echo $this->getUnsubscribeAllUrl() ?>">Unsubscribe</a>
Additional you can specify a target URL as the parameter to this method to which customer will be redirected after unsubscription:
<a href="<?php echo $this->getUnsubscribeAllUrl($this->helper('cms/page')->getPageUrl(10)) ?>">Unsubscribe</a>
I.e. customer will be redirected to the CMS page with ID 10.
You can subscribe customer back, follow subscribe instruction for this.
-
getUnsubscribeNewsletterUrl - a direct link to unsubscribe from all triggers and newsletter
Customer will be unsubscribed from all already scheduled emails (Follow Up Email > Mail Log (Queue)) for all triggers.
This link also unsubscribe customer from native magento subscription.
Usage:
<a href="<?php echo $this->getUnsubscribeNewsletterUrl() ?>">Unsubscribe</a>
Additional you can specify a target URL as the parameter to this method to which customer will be redirected after unsubscription:
<a href="<?php echo $this->getUnsubscribeNewsletterUrl($this->helper('cms/page')->getPageUrl(10)) ?>">Unsubscribe</a>
I.e. customer will be redirected to the CMS page with ID 10.
You can subscribe customer back, follow subscribe instruction for this.
-
getSubscribeUrl - a direct link to subscribe client back to the trigger's emails
Customer will be subscribed back to all the emails for current trigger.
Usage:
<a href="<?php echo $this->getSubscribeUrl() ?>">Subscribe</a>
Additional you can specify a target URL as the parameter to this method to which customer will be redirected after subscription:
<a href="<?php echo $this->getSubscribeUrl($this->helper('cms/page')->getPageUrl(10)) ?>">Subscribe</a>
-
getViewInBrowserUrl - a direct link to open email in browser
Usage:
<a href="<?php echo $this->getViewInBrowserUrl() ?>">View it in your browser.</a>
-
getResumeUrl - a direct link to resume (restore, log in) customer session
Usage:
<a href="<?php echo $this->getResumeUrl() ?>">Open</a>
I.e. customer will be automatically authorizated in store.
Additionally you can pass parameter to method for redirect customer to specific url after authorization.
<?php foreach($this->getOrder()->getAllVisibleItems() as $item): ?> <tr> <td> <a href="<?php echo $this->getResumeUrl($item->getProduct()->getProductUrl()) ?>">Review <?php echo $item->getName() ?></a> </td> </tr> <?php endforeach ?>
I.e. customer will be automatically redirected to product page for leave review after automatically authorization.
-
getStoreUrl - a direct link to store home page
Usage:
<?php echo $this->getStoreUrl() ?>
-
getStoreName - a curent store name
Usage:
<?php echo $this->getStoreName() ?>
-
getStorePhone - a curent store phone
Usage:
<?php echo $this->getStorePhone() ?>
-
getStoreAddress - a curent store address
Usage:
<?php echo $this->getStoreAddress() ?>
-
getStoreEmail - a curent store general transactional email
Usage:
<?php echo $this->getStoreEmail() ?>
-
getStoreHours - a curent store hours
Usage:
<?php echo $this->getStoreHours() ?>
-
getLogoUrl - retruns URL to logo used at store header
Usage:
<?php echo $this->getLogoUrl() ?>
-
getLogoAlt - retruns alt for logo used at store header
Usage:
<?php echo $this->getLogoAlt() ?>
-
getEmailLogoUrl - retruns URL to logo used for emails
Usage:
<?php echo $this->getEmailLogoUrl() ?>
-
getFacebookUrl - retruns facebook URL specified at the extension settings
Usage:
<?php echo $this->getFacebookUrl() ?>
-
getTwitterUrl - retruns twitter URL specified at the extension settings
Usage:
<?php echo $this->getTwitterUrl() ?>
-
getFormatedDate - returns the date formatted according to the given parameter
Usage:
<?php echo $this->getFormatedDate($this->getQuote()->getUpdatedAt(), 'full') ?>
- Monday, November 23, 2015<?php echo $this->getFormatedDate($this->getOrder()->getCreatedAt(), 'long') ?>
- November 23, 2015<?php echo $this->getFormatedDate($this->getOrder()->getUpdatedAt(), 'medium') ?>
- Nov 23, 2015<?php echo $this->getFormatedDate($this->getQuote()->getCreatedAt(), 'short') ?>
- 11/23/2015 -
getFaviconFile - returns path to favicon icon (since version 1.0.36)
Usage:
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<?php if ($this->getFaviconFile()): ?> <link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" /> <?php endif ?>
Customer Methods
-
getCustomerName - returns customer's full name
Usage:
Dear <?php echo $this->getCustomerName() ?>
You can pass a parameter to the method getCustomerName() which will be used instead of the customer name, if customer's name is empty:
Dear <?php echo $this->getCustomerName('Customer') ?>
, results in Dear Customer, if customer's name is empty (since version 1.0.34). -
getFirstname - returns customer's firstname (since version 1.0.36)
Usage:
Dear <?php echo $this->getFirstname() ?>
-
getLastname - returns customer's lastname (since version 1.0.36)
Usage:
Dear <?php echo $this->getLastname() ?>
-
getCustomer - retrurns customer's object (only for registered customers)
Usage:
Hi <?php echo $this->getCustomer()->getFirstname() ?>
<?php echo $this->getCustomer()->getEmail() ?>
-
getPrimaryShippingAddress - returns customer shipping address object
Usage:
Your shipping address: <?php echo $this->getCustomer()->getPrimaryShippingAddress()->format('html') ?>
Returns customer's shipping address in HTML format. Instead of html it's also possible to use the following formats: text, oneline, pdf and js_template.
<?php if($this->getCustomer()->getPrimaryShippingAddress()): ?> <p><?php echo $this->getCustomer()->getPrimaryShippingAddress()->format('oneline') ?></p> <?php endif ?>
-
getPrimaryBillingAddress - returns customer billing address object
Usage:
Your billing address: <?php echo $this->getCustomer()->getPrimaryBillingAddress()->format('html') ?>
Returns customer's billing address in HTML format. Instead of html it's also possible to use the following formats: text, oneline, pdf and js_template.
<?php if($this->getCustomer()->getPrimaryBillingAddress()): ?> <p><?php echo $this->getCustomer()->getPrimaryBillingAddress()->format('oneline') ?></p> <?php endif ?>
Shopping Cart Methods
-
getRestoreCartUrl - a direct link to customer shopping cart
Usage:
<a href="<?php echo $this->getRestoreCartUrl() ?>">Finish Checkout!</a>
-
getQuote()->getAllVisibleItems() - return collection of products in cart for feature output
Usage:
<?php foreach ($this->getQuote()->getAllVisibleItems() as $item): ?> <?php echo $item->getName() ?> <?php endforeach ?>
-
getAddToCartUrl - a direct link to customer shopping cart with specified product
Usage:
<a href="<?php echo $this->getAddToCartUrl(388) ?>">Add to cart</a>
Customer will be automatically authorizated in store and redirected to a shopping cart with the specified product.
Order Methods
-
getOrder()->getStatus() - the status of order
Usage:
order status is <?php echo $this->getOrder()->getStatus() ?>
-
getOrder()->getIncrementId() - the order number
Usage:
Order #<?php echo $this->getOrder()->getIncrementId() ?>
-
getOrder()->getStoreGroupName() - the store name of order
Usage:
You placed order in <?php echo $this->getOrder()->getStoreGroupName() ?>
-
getOrder()->getAllVisibleItems() - return list of products in order for feature output
Usage:
<?php foreach ($this->getOrder()->getAllVisibleItems() as $item): ?> <?php echo $item->getName() ?> <?php endforeach ?>
-
getOrder()->getShippingAddress() - return shipping address object which can be used to retrieve information from customer's shipping address
Usage:
<?php echo $this->getOrder()->getShippingAddress()->getCountryId() ?> <?php echo $this->getOrder()->getShippingAddress()->getRegion() ?> <?php echo $this->getOrder()->getShippingAddress()->getPostcode() ?> <?php echo $this->getOrder()->getShippingAddress()->getCity() ?> <?php echo $this->getOrder()->getShippingAddress()->getStreet() ?> <?php echo $this->getOrder()->getShippingAddress()->getTelephone() ?> <?php echo $this->getOrder()->getShippingAddress()->getComplany() ?>
The same methods can be called from the billing address object, but instead of thegetShippingAddress()
you need to call the methodgetBillingAddress()
:<?php echo $this->getOrder()->getShippingAddress()->getCity() ?> <?php echo $this->getOrder()->getShippingAddress()->getComplany() ?>
-
getReorderUrl - a direct link to reorder customer order
Usage:
<a href="<?php echo $this->getResumeUrl($this->getReorderUrl($this->getOrder())) ?>">Reorder</a>
I.e. customer will be automatically redirected to the checkout to reorder an order after automatically authorization in a store.
-
Retrieve order tracking number by carrier code
Usage:
<?php $track = Mage::getModel('sales/order_shipment_track')->getCollection() ->addFieldToFilter('order_id', $this->getOrder()->getId()) ->addFieldToFilter('carrier_code', 'your_carrier_code') ->getFirstItem(); ?>
Where 'your_carrier_code' - is the carrier code of a track which is used for this shipment (or which you want to retrieve). Below specified some of the default carrier codes provided by Magento:
- "custom"
- "fedex"
- "dhl"
- "ups"
- "usps"
- "dhlint"
I.e. to retrieve information for carrier code "fedex" use:
->addFieldToFilter('carrier_code', 'fedex')
To see which information stored in this tracking code you can use the code below:
<?php echo '<pre>'; print_r($track->getData()); echo '</pre>'; die(); ?>
And use this code to retrieve any field you want, example of retrieving the value of tracking number:
<?php echo $track->getTrackNumber() ?>
.Another example:
<a href="http://tracking.site.com/track.php?id=<?php echo $track->getTrackNumber() ?>">View tracking info</a>
-
Retrieve all order tracking numbers
First you need to get shipment for the order:
<?php $shipment = Mage::getModel('sales/order_shipment')->load($this->getOrder()->getId(), 'order_id'); ?>
Next you need to create a cycle to iterate through all the tracks for this shipment:
<?php foreach ($shipment->getAllTracks() as $track): ?> Track Number: <?php echo $track->getTrackNumber() ?> Carrier Code: <?php echo $track->getCarrierCode() ?> <?php endforeach ?>
You can use this code in all order-related email templates.
-
Additional Methods
Usage:
<?php echo $this->getOrder()->getBaseTaxAmount() ?> <?php echo $this->getOrder()->getBaseGrandTotal() ?> <?php echo $this->getOrder()->getBaseShippingAmount() ?> <?php echo $this->getOrder()->getShippingDescription() ?> - returns shipping method name <?php echo $this->getOrder()->getPayment()->getMethodInstance()->getTitle() ?> - returns order payment method title
Coupons
-
getCoupon()->getCode() - the autogenerated coupon code
Usage:
Your coupon code: <?php echo $this->getCoupon()->getCode() ?>
<?php if ($this->getCoupon()): ?> Let us offer you a discount to complete your purchase.<br> Your coupon code: <?php echo $this->getCoupon()->getCode() ?> <?php endif ?>
I.e. we display this text block, only if coupon is available.
Our extension generates the coupon codes based on the selected shopping cart price rule.To be able to generate the coupon codes you should check the option "Use Auto Generation" at the shopping cart price rule.
-
getCouponExpiryDate() - the expired date for autogenerated coupon code (since version 1.1.4)
Usage:
Your coupon code valid until: <?php echo $this->getFormatedDate($this->getCouponExpiryDate(), 'short') ?>
Cross sell products
-
getCrossSellHtml - html block of cross sell products
Usage:
<?php echo getCrossSellHtml() ?>
<?php if ($this->getCrossSellHtml()): ?> <h1>See also:</h1> <?php echo $this->getCrossSellHtml() ?> <?php endif ?>
I.e. we display this text block, only if products are available.
Products Methods
-
getProductUrl - a direct link to the product
Usage:
<?php echo $item->getProduct()->getProductUrl() ?>
-
getPrice - a price of the product
Usage:
<?php echo $item->getProduct()->getPrice() ?>
<?php echo $this->getFormattedPrice($item->getProduct()->getPrice()) ?>
-
getPriceInclTax - a price of the product with tax (saved in order/shopping cart)
Usage:
<?php echo $item->getPriceInclTax() ?>
<?php echo $this->getFormattedPrice($item->getPriceInclTax()) ?>
-
getName - a name of the product
Usage:
<a href="<?php echo $item->getProduct()->getProductUrl() ?>"><?php echo $item->getName() ?></a>
-
getAttribute - method allows you to print or return product attribute value according to a given mask:
Set last parameter to true in order to print the result:
Usage:
<?php $this->getAttribute($item->getProduct(), 'manufacturer', '<h1>Brand: %s</h1>', true) ?>
Do not pass last parameter to return the result:
Usage:
<?php echo $this->getAttribute($item->getProduct(), 'manufacturer', '<h1>Brand: %s</h1>') ?>
-
getReviewUrl - a direct link to product review page
Usage:
<a href="<?php echo $this->getReviewUrl($product) ?>">Leave Review</a>
I.e. customer will be automatically authorizated in store.
<?php foreach($this->getOrder()->getAllVisibleItems() as $item): ?> <tr> <td> <a href="<?php echo $this->getReviewUrl($item->getProduct()) ?>">Review <?php echo $item->getName() ?></a> </td> </tr> <?php endforeach ?>
I.e. customer will be automatically redirected to product page to leave a review after automatic authorization.
In order to redirect customer to the product review page use the following code:
<a href="<?php echo $this->getResumeUrl(Mage::getUrl('review/product/list', array('id' => $item->getProductId(), '_fragment' => 'review-form'))) ?>">Review <?php echo $item->getName() ?></a>
-
Image Directive
Usage:
<img src="<?php echo $this->getImageUrl($item->getProduct(), 100) ?>"/>
<img src="<?php echo $this->getSmallImageUrl($item->getProduct(), 150) ?>"/>
<img src="<?php echo $this->getThumbnailUrl($item->getProduct()) ?>"/>
Wishlist Methods
-
getWishlist()->getItemCollection() - return collection of products in wishlist for feature output
Usage:
<?php foreach ($this->getWishlist()->getItemCollection() as $item): ?> <img src="<?php echo $this->getImageUrl($item->getProduct(), 100) ?>"/> <a href="<?php echo $item->getProduct()->getProductUrl() ?>"><?php echo $item->getProduct()->getName() ?></a> <?php endforeach ?>
Alternative way of retrieving wishlist products:
<?php foreach ($this->getWishlistItemCollection() as $item): ?> <img src="<?php echo $this->getImageUrl($item->getProduct(), 100) ?>"/> <a href="<?php echo $item->getProduct()->getProductUrl() ?>"><?php echo $item->getProduct()->getName() ?></a> <?php endforeach ?>
-
getWishlistProduct() - return last added product to wishlist for feature output
Usage:
<a href="<?php echo $this->getWishlistProduct()->getProductUrl() ?>"><?php echo $this->getWishlistProduct()->getName() ?></a>
Price: <?php echo $this->getWishlistProduct()->getPrice() ?>
Gift Registry Methods
-
getRegistry() - return gift registry for feature output
Usage:
<p>Gift registry name: <?php echo $this->getRegistry()->getName() ?></p>
<p>Gift registry view link: <?php echo $this->getRegistry()->getViewUrl() ?></p>
-
getRegistry()->getItemCollection() - returns collection of products in gift registry for feature output
Usage:
<?php foreach ($this->getRegistry()->getItemCollection() as $item): ?> <img src="<?php echo $this->getImageUrl($item->getProduct(), 100) ?>"/> <a href="<?php echo $item->getProduct()->getProductUrl() ?>"><?php echo $item->getProduct()->getName() ?></a> <b><?php echo $this->getFormattedPrice($item->getProduct()->getPrice()) ?></b> <?php endforeach ?>
Alternative way of retrieving wishlist products:
<?php foreach ($this->getRegistryItems() as $item): ?> <img src="<?php echo $this->getImageUrl($item->getProduct(), 100) ?>"/> <a href="<?php echo $item->getProduct()->getProductUrl() ?>"><?php echo $item->getProduct()->getName() ?></a> <b><?php echo $this->getFormattedPrice($item->getProduct()->getPrice()) ?></b> <?php endforeach ?>
Additional Methods
-
Print all properties for order object:
Usage:
<?php echo '<pre>'; print_r($this->getOrder()->getData()); echo ' </pre>'; die(); ?>
-
Print all properties for order item object:
Usage:
<?php foreach ($this->getOrder()->getAllVisibleItems() as $item): ?> <?php echo '<pre>'; print_r($item->getData()); echo ' </pre>'; die(); ?> <?php endforeach ?>
-
Print all properties for product object:
Usage:
<?php foreach ($this->getOrder()->getAllVisibleItems() as $item): ?> <?php echo '<pre>'; print_r($item->getProduct()->getData()); echo ' </pre>'; die(); ?> <?php endforeach ?>
-
Print all properties for customer object:
Usage:
<?php echo '<pre>'; print_r($this->getCustomer()->getData()); echo ' </pre>'; die(); ?>
-
Print all properties for wishlist object:
Usage:
<?php echo '<pre>'; print_r($this->getWishlist()->getData()); echo ' </pre>'; die(); ?>
[property_code] => property value
[another_property_code] => property value
[one_more_property_code] => property value
Each property can be accessed separately as follows:
<?php echo $this->getOrder()->getPropertyCode() ?>
<?php echo $this->getOrder()->getAnotherPropertyCode() ?>
<?php echo $this->getOrder()->getShippingAddress()->getAnotherPropertyCode() ?>
<?php echo $this->getOrder()->getPayment()->getPropertyCode() ?>
<?php echo $this->getCustomer()->getPropertyCode() ?>
<?php echo $this->getWishlist()->getOneMorePropertyCode() ?>
<?php echo $item->getProduct()->getPropertyCode() ?>
Your feedback about this content is important.
Let us know what you think.