mailpoet
/
lib
/
EmailEditor
/
Integrations
/
MailPoet
/
Patterns
/
Library
/
ProductPurchaseFollowUpPattern.php
AbandonedCartPattern.php
4 months ago
AbandonedCartReminderPattern.php
1 month ago
AbandonedCartWithDiscountPattern.php
1 month ago
AbstractAbandonedCartPattern.php
5 months ago
AskForReviewPostPurchasePattern.php
1 month ago
BirthdayEmailPattern.php
1 month ago
BookingAutomationEmailPattern.php
1 month ago
CategoryPurchaseFollowUpPattern.php
1 month ago
EducationalCampaignPattern.php
1 month ago
EventInvitationPattern.php
3 months ago
FirstPurchaseThankYouPattern.php
1 month ago
NewArrivalsAnnouncementPattern.php
3 months ago
NewProductsAnnouncementPattern.php
3 months ago
NewsletterPattern.php
4 months ago
PostPurchaseThankYouPattern.php
1 month ago
ProductPurchaseFollowUpPattern.php
1 month ago
ProductRestockNotificationPattern.php
5 months ago
SaleAnnouncementPattern.php
3 months ago
SubscriptionAutomationEmailPattern.php
1 month ago
TagPurchaseFollowUpPattern.php
1 month ago
WelcomeEmailPattern.php
1 month ago
WelcomeWithDiscountEmailPattern.php
1 month ago
WinBackCustomerPattern.php
1 month ago
index.php
1 year ago
ProductPurchaseFollowUpPattern.php
85 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\EmailEditor\Integrations\MailPoet\Patterns\Library; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\EmailEditor\Integrations\MailPoet\EmailEditor; |
| 9 | use MailPoet\EmailEditor\Integrations\MailPoet\Patterns\Pattern; |
| 10 | use MailPoet\EmailEditor\Integrations\MailPoet\ProductCollection\OrderProductCollectionProcessor; |
| 11 | |
| 12 | /** |
| 13 | * Product purchase follow-up email pattern. |
| 14 | * |
| 15 | * The product grid uses the order cross-sells collection: at send time it shows |
| 16 | * cross-sells of the purchased products (or their related products as backup), |
| 17 | * so the recommendations match what the customer actually bought. |
| 18 | */ |
| 19 | class ProductPurchaseFollowUpPattern extends Pattern { |
| 20 | protected $name = 'product-purchase-follow-up'; |
| 21 | protected $block_types = ['core/post-content']; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps |
| 22 | protected $template_types = ['email-template']; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps |
| 23 | protected $categories = ['purchase']; |
| 24 | protected $post_types = [EmailEditor::MAILPOET_EMAIL_POST_TYPE]; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps |
| 25 | |
| 26 | /** |
| 27 | * Get pattern content. |
| 28 | * |
| 29 | * @return string Pattern HTML content. |
| 30 | */ |
| 31 | protected function get_content(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 32 | return $this->buildContent($this->getProductPlaceholderColumns([ |
| 33 | 'product-small-03.jpg', |
| 34 | 'product-small-05.jpg', |
| 35 | 'product-small-04.jpg', |
| 36 | 'product-small-06.jpg', |
| 37 | ])); |
| 38 | } |
| 39 | |
| 40 | public function get_email_content(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 41 | return $this->buildContent($this->getRecommendedProductCollectionBlock( |
| 42 | OrderProductCollectionProcessor::COLLECTION_ORDER_CROSS_SELLS, |
| 43 | 'popularity' |
| 44 | )); |
| 45 | } |
| 46 | |
| 47 | private function buildContent(string $productSection): string { |
| 48 | return ' |
| 49 | <!-- wp:group {"style":{"spacing":{"padding":{"right":"var:preset|spacing|40","left":"var:preset|spacing|40"}}},"layout":{"type":"constrained"}} --> |
| 50 | <div class="wp-block-group" style="padding-right:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)"> |
| 51 | <!-- wp:heading {"level":1} --> |
| 52 | <h1 class="wp-block-heading">' . |
| 53 | /* translators: PRODUCT NAME is placeholder text that merchants replace with their own content. */ |
| 54 | __('Loving your PRODUCT NAME? Make it even better', 'mailpoet') . '</h1> |
| 55 | <!-- /wp:heading --> |
| 56 | |
| 57 | <!-- wp:paragraph {"style":{"typography":{"fontSize":"16px"},"spacing":{"padding":{"top":"0","bottom":"var:preset|spacing|30"}}}} --> |
| 58 | <p style="padding-top:0;padding-bottom:var(--wp--preset--spacing--30);font-size:16px">' . |
| 59 | __('Here are a few essentials that pair perfectly with your purchase.', 'mailpoet') . '</p> |
| 60 | <!-- /wp:paragraph --> |
| 61 | |
| 62 | ' . $productSection . ' |
| 63 | |
| 64 | <!-- wp:spacer {"height":"30px"} --> |
| 65 | <div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div> |
| 66 | <!-- /wp:spacer --> |
| 67 | |
| 68 | <!-- wp:paragraph {"fontSize":"medium"} --> |
| 69 | <p class="has-medium-font-size">' . __('Happy shopping!', 'mailpoet') . '</p> |
| 70 | <!-- /wp:paragraph --> |
| 71 | |
| 72 | <!-- wp:paragraph {"fontSize":"medium"} --> |
| 73 | <p class="has-medium-font-size">–<!--[woocommerce/site-title]--></p> |
| 74 | <!-- /wp:paragraph --> |
| 75 | </div> |
| 76 | <!-- /wp:group --> |
| 77 | '; |
| 78 | } |
| 79 | |
| 80 | protected function get_title(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 81 | /* translators: Name of a content pattern used as starting content of an email */ |
| 82 | return __('Product Purchase Follow-Up', 'mailpoet'); |
| 83 | } |
| 84 | } |
| 85 |