CrossUpSellsProducts.php in YayMail – WooCommerce Email Customizer 4.4.5, at src/Elements/CrossUpSellsProducts.php
| 1 | <?php |
| 2 | namespace YayMail\Elements; |
| 3 | |
| 4 | use YayMail\Abstracts\BaseElement; |
| 5 | use YayMail\Utils\SingletonTrait; |
| 6 | |
| 7 | /** |
| 8 | * Cross/Up Sells Products Elements |
| 9 | */ |
| 10 | class CrossUpSellsProducts extends BaseElement { |
| 11 | |
| 12 | use SingletonTrait; |
| 13 | |
| 14 | protected static $type = 'cross_up_sells_products'; |
| 15 | |
| 16 | public $available_email_ids = []; |
| 17 | |
| 18 | public static function get_data( $attributes = [] ) { |
| 19 | self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 20 20"> |
| 20 | <g> |
| 21 | <path d="M7.7,2.7v9.75H2.5V2.7h5.2M8.7,1.2H1.5c-.28,0-.5.22-.5.5v11.75c0,.28.22.5.5.5h7.2c.28,0,.5-.22.5-.5V1.7c0-.28-.22-.5-.5-.5h0Z"/> |
| 22 | <g> |
| 23 | <path d="M8,16.49H2.21c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h5.79c.41,0,.75.34.75.75s-.34.75-.75.75Z"/> |
| 24 | <path d="M7.19,18.95H3.01c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h4.19c.41,0,.75.34.75.75s-.34.75-.75.75Z"/> |
| 25 | </g> |
| 26 | </g> |
| 27 | <g> |
| 28 | <path d="M17.5,2.7v9.75h-5.2V2.7h5.2M18.5,1.2h-7.2c-.28,0-.5.22-.5.5v11.75c0,.28.22.5.5.5h7.2c.28,0,.5-.22.5-.5V1.7c0-.28-.22-.5-.5-.5h0Z"/> |
| 29 | <path d="M17.79,16.49h-5.79c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h5.79c.41,0,.75.34.75.75s-.34.75-.75.75Z"/> |
| 30 | <path d="M16.99,18.95h-4.19c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h4.19c.41,0,.75.34.75.75s-.34.75-.75.75Z"/> |
| 31 | </g> |
| 32 | </svg>'; |
| 33 | |
| 34 | $buy_button_conditions = [ |
| 35 | [ |
| 36 | 'comparison' => 'contain', |
| 37 | 'value' => [ 'buy_button' ], |
| 38 | 'attribute' => 'showing_items', |
| 39 | ], |
| 40 | ]; |
| 41 | |
| 42 | return [ |
| 43 | 'id' => uniqid(), |
| 44 | 'type' => self::$type, |
| 45 | 'name' => __( 'Cross/Up Sells Products', 'yaymail' ), |
| 46 | 'icon' => self::$icon, |
| 47 | 'group' => 'block', |
| 48 | 'tags' => [ 'woocommerce' ], |
| 49 | 'available' => false, |
| 50 | 'disabled_reason' => [ |
| 51 | 'html' => '<svg id="yaymail-cross_up_sells_products" class="yaymail-element-disabled-icon" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 428.5 300"><defs><style> #yaymail-cross_up_sells_products .st0 { fill: #fff; } #yaymail-cross_up_sells_products .st1 { fill: #edeff3; } #yaymail-cross_up_sells_products .st2 { fill: #1f2937; } #yaymail-cross_up_sells_products .st3 { fill: #dee2e9; } #yaymail-cross_up_sells_products .st4 { fill: #c9ced6; } </style></defs><rect class="st0" width="428.5" height="300"/><rect class="st3" x="76.3" y="75.1" width="275.8" height="13.6" rx="6.8" ry="6.8"/><g><path class="st1" d="M41.2,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8H41.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M52.5,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="31.7" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st3" x="43.6" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><g><circle class="st3" cx="85.3" cy="260.5" r="1.7"/><circle class="st3" cx="78.3" cy="260.5" r="1.7"/><path class="st3" d="M89.8,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.3-.4,1.6-1.1l1.9-4.8c.2-.5.2-1.1-.2-1.6h0Z"/></g></g><g><path class="st1" d="M173.7,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-80.7c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M184.9,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="164.2" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st3" x="176.1" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><g><circle class="st3" cx="217.7" cy="260.5" r="1.7"/><circle class="st3" cx="210.8" cy="260.5" r="1.7"/><path class="st3" d="M222.2,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.4-.4,1.6-1.1l1.9-4.8c.2-.5.1-1.1-.2-1.6h0Z"/></g></g><g><path class="st1" d="M306.6,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-80.7c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M317.8,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="297.1" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st3" x="309" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><g><circle class="st3" cx="350.6" cy="260.5" r="1.7"/><circle class="st3" cx="343.7" cy="260.5" r="1.7"/><path class="st3" d="M355.1,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.4-.4,1.6-1.1l1.9-4.8c.2-.5.1-1.1-.2-1.6h0Z"/></g></g><path class="st4" d="M73.4,139.5c-2.8,0-5.1-2.4-5.1-5.2,0-2.8,2.4-5.1,5.2-5.1,2.8,0,5.2,2.4,5.1,5.2,0,2.8-2.4,5.1-5.2,5.1ZM104.5,162.9c-7.6,0-15.2,0-22.9,0h-23.6c-.7,0-1.5,0-1.8-.7-.4-.7,0-1.4.4-2,3-4.2,6-8.4,9.1-12.5,1.3-1.8,2.9-1.7,4.3,0,.8,1.1,1.6,2.2,2.4,3.3,1.4,1.8,3.2,1.8,4.6,0,.7-.9,1.3-1.7,1.9-2.6,2.5-3.5,5-7,7.6-10.4.8-1.2,1.9-1.5,3.1-1,.6.3,1,.8,1.4,1.4,5.1,7.1,10.3,14.2,15.4,21.3.5.7,1.3,1.5.8,2.5-.5,1.1-1.6.8-2.5.8h0Z"/><path class="st4" d="M205.8,139.5c-2.8,0-5.1-2.4-5.1-5.2,0-2.8,2.4-5.1,5.1-5.1,2.8,0,5.2,2.4,5.1,5.2,0,2.8-2.4,5.1-5.2,5.1ZM236.9,162.9c-7.6,0-15.2,0-22.9,0h-23.6c-.7,0-1.5,0-1.8-.7-.4-.7,0-1.4.4-2,3-4.2,6-8.4,9.1-12.5,1.3-1.8,2.9-1.7,4.3,0,.8,1.1,1.6,2.2,2.4,3.3,1.4,1.8,3.2,1.8,4.6,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,3.3-4.6s-.4-4.5-3.2-4.5-3.3,1.7-3.3,4.6ZM326,46.8c0,1.3,0,2.9,0,4h-3.3c0-.4,0-1.1,0-1.8-.8,1.4-2,2.1-3.9,2.1s-4.6-1.5-4.6-5.1v-9.1h3.3v8.4c0,1.6.5,3,2.4,3s2.8-1.1,2.8-4.1v-7.3h3.4v9.8ZM341.4,46.4c-.5,2.3-2.1,4.7-6.1,4.7s-6.4-2.9-6.4-7.2,2.4-7.4,6.6-7.4,5.8,3.2,5.9,4.8h-3.3c-.3-1.2-1-2.2-2.7-2.2s-3.1,1.7-3.1,4.6,1.2,4.6,3.1,4.6,2.3-.8,2.7-2.1h3.3ZM342.7,36.9h2.2v-3.9h3.4v3.9h2.8v2.6h-2.8v7.3c0,1.2.3,1.7,1.5,1.7s.7,0,1,0v2.4c-.7.2-1.7.3-2.4.3-2.5,0-3.4-1.3-3.4-3.7v-7.8h-2.2v-2.6ZM355.9,46.7c.3,1.2,1.3,2,2.9,2s2.2-.6,2.2-1.6-.6-1.5-2.8-2c-4.3-1.1-5.1-2.4-5.1-4.3s1.4-4.1,5.4-4.1,5.4,2.2,5.6,4.1h-3.2c-.1-.6-.6-1.7-2.5-1.7s-2,.7-2,1.4.5,1.2,2.8,1.8c4.5,1.1,5.2,2.6,5.2,4.6s-1.8,4.3-5.8,4.3-5.8-2-6.1-4.4h3.3Z"/></svg>' |
| 52 | . '<span>' |
| 53 | . self::get_pro_upgrade_text() |
| 54 | . '</span>', |
| 55 | ], |
| 56 | 'position' => 220, |
| 57 | 'status_info' => [ |
| 58 | 'text' => __( 'New', 'yaymail' ), |
| 59 | ], |
| 60 | 'data' => [ |
| 61 | 'padding' => [ |
| 62 | 'value_path' => 'padding', |
| 63 | 'component' => 'Spacing', |
| 64 | 'title' => __( 'Padding', 'yaymail' ), |
| 65 | 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [ |
| 66 | 'top' => '15', |
| 67 | 'right' => '50', |
| 68 | 'bottom' => '15', |
| 69 | 'left' => '50', |
| 70 | ], |
| 71 | 'type' => 'style', |
| 72 | ], |
| 73 | 'background_color' => [ |
| 74 | 'value_path' => 'background_color', |
| 75 | 'component' => 'Color', |
| 76 | 'title' => __( 'Background color', 'yaymail' ), |
| 77 | 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff', |
| 78 | 'type' => 'style', |
| 79 | ], |
| 80 | 'text_color' => [ |
| 81 | 'value_path' => 'text_color', |
| 82 | 'component' => 'Color', |
| 83 | 'title' => __( 'Text color', 'yaymail' ), |
| 84 | 'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT, |
| 85 | 'type' => 'style', |
| 86 | ], |
| 87 | 'font_family' => [ |
| 88 | 'value_path' => 'font_family', |
| 89 | 'component' => 'FontFamilySelector', |
| 90 | 'title' => __( 'Font family', 'yaymail' ), |
| 91 | 'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY, |
| 92 | 'type' => 'style', |
| 93 | ], |
| 94 | 'content_breaker' => [ |
| 95 | 'component' => 'LineBreaker', |
| 96 | ], |
| 97 | 'content_group_definition' => [ |
| 98 | 'component' => 'GroupDefinition', |
| 99 | 'title' => __( 'Content', 'yaymail' ), |
| 100 | 'description' => __( 'Handle block items settings', 'yaymail' ), |
| 101 | ], |
| 102 | 'showing_items' => [ |
| 103 | 'value_path' => 'showing_items', |
| 104 | 'component' => 'CheckboxGroup', |
| 105 | 'title' => __( 'Showing items', 'yaymail' ), |
| 106 | 'default_value' => isset( $attributes['showing_items'] ) ? $attributes['showing_items'] : [ 'top_content', 'product_image', 'product_name', 'product_price', 'product_original_price', 'buy_button' ], |
| 107 | 'type' => 'content', |
| 108 | 'options' => [ |
| 109 | [ |
| 110 | 'label' => __( 'Top content', 'yaymail' ), |
| 111 | 'value' => 'top_content', |
| 112 | ], |
| 113 | [ |
| 114 | 'label' => __( 'Product image', 'yaymail' ), |
| 115 | 'value' => 'product_image', |
| 116 | ], |
| 117 | [ |
| 118 | 'label' => __( 'Product name', 'yaymail' ), |
| 119 | 'value' => 'product_name', |
| 120 | ], |
| 121 | [ |
| 122 | 'label' => __( 'Product price', 'yaymail' ), |
| 123 | 'value' => 'product_price', |
| 124 | ], |
| 125 | [ |
| 126 | 'label' => __( 'Product original price', 'yaymail' ), |
| 127 | 'value' => 'product_original_price', |
| 128 | ], |
| 129 | [ |
| 130 | 'label' => __( 'Buy button', 'yaymail' ), |
| 131 | 'value' => 'buy_button', |
| 132 | ], |
| 133 | ], |
| 134 | ], |
| 135 | 'top_content' => [ |
| 136 | 'value_path' => 'top_content', |
| 137 | 'component' => 'RichTextEditor', |
| 138 | 'title' => __( 'Top content', 'yaymail' ), |
| 139 | 'default_value' => isset( $attributes['top_content'] ) ? $attributes['top_content'] : '<p style="text-align: center;"><span style="font-size: 18px;"><strong>CROSS/UP SELLS PRODUCTS</strong></span></p> |
| 140 | <p style="font-size: 14px; text-align: center;"> </p> |
| 141 | <p style="text-align: center;">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>', |
| 142 | 'type' => 'content', |
| 143 | 'conditions' => [ |
| 144 | [ |
| 145 | 'comparison' => 'contain', |
| 146 | 'value' => [ 'top_content' ], |
| 147 | 'attribute' => 'showing_items', |
| 148 | ], |
| 149 | ] |
| 150 | ], |
| 151 | 'sale_price_color' => [ |
| 152 | 'value_path' => 'sale_price_color', |
| 153 | 'component' => 'Color', |
| 154 | 'title' => __( 'Product price color', 'yaymail' ), |
| 155 | 'default_value' => isset( $attributes['sale_price_color'] ) ? $attributes['sale_price_color'] : '#ec4770', |
| 156 | 'type' => 'style', |
| 157 | 'conditions' => [ |
| 158 | [ |
| 159 | 'comparison' => 'contain', |
| 160 | 'value' => [ 'product_price' ], |
| 161 | 'attribute' => 'showing_items', |
| 162 | ], |
| 163 | ], |
| 164 | ], |
| 165 | 'regular_price_color' => [ |
| 166 | 'value_path' => 'regular_price_color', |
| 167 | 'component' => 'Color', |
| 168 | 'title' => __( 'Product original price color', 'yaymail' ), |
| 169 | 'default_value' => isset( $attributes['regular_price_color'] ) ? $attributes['regular_price_color'] : '#808080', |
| 170 | 'type' => 'style', |
| 171 | 'conditions' => [ |
| 172 | [ |
| 173 | 'comparison' => 'contain', |
| 174 | 'value' => [ 'product_original_price' ], |
| 175 | 'attribute' => 'showing_items', |
| 176 | ], |
| 177 | ], |
| 178 | ], |
| 179 | 'button_breaker' => [ |
| 180 | 'component' => 'LineBreaker', |
| 181 | 'conditions' => $buy_button_conditions, |
| 182 | ], |
| 183 | 'button_group_definition' => [ |
| 184 | 'component' => 'GroupDefinition', |
| 185 | 'title' => __( 'Button', 'yaymail' ), |
| 186 | 'description' => __( 'Handle buy button settings', 'yaymail' ), |
| 187 | 'conditions' => $buy_button_conditions, |
| 188 | ], |
| 189 | 'buy_button_label' => [ |
| 190 | 'value_path' => 'buy_button_label', |
| 191 | 'component' => 'TextInput', |
| 192 | 'title' => __( 'Buy button text', 'yaymail' ), |
| 193 | 'default_value' => isset( $attributes['buy_button_label'] ) ? $attributes['buy_button_label'] : __( 'BUY NOW', 'yaymail' ), |
| 194 | 'type' => 'content', |
| 195 | 'conditions' => $buy_button_conditions, |
| 196 | ], |
| 197 | 'buy_button_background_color' => [ |
| 198 | 'value_path' => 'buy_button_background_color', |
| 199 | 'component' => 'Color', |
| 200 | 'title' => __( 'Buy button background color', 'yaymail' ), |
| 201 | 'default_value' => isset( $attributes['buy_button_background_color'] ) ? $attributes['buy_button_background_color'] : '#ec4770', |
| 202 | 'type' => 'style', |
| 203 | 'conditions' => $buy_button_conditions, |
| 204 | ], |
| 205 | 'buy_button_text_color' => [ |
| 206 | 'value_path' => 'buy_button_text_color', |
| 207 | 'component' => 'Color', |
| 208 | 'title' => __( 'Buy button text color', 'yaymail' ), |
| 209 | 'default_value' => isset( $attributes['buy_button_text_color'] ) ? $attributes['buy_button_text_color'] : '#ffffff', |
| 210 | 'type' => 'style', |
| 211 | 'conditions' => $buy_button_conditions, |
| 212 | ], |
| 213 | 'products_breaker' => [ |
| 214 | 'component' => 'LineBreaker', |
| 215 | ], |
| 216 | 'products_group_definition' => [ |
| 217 | 'component' => 'GroupDefinition', |
| 218 | 'title' => __( 'Products', 'yaymail' ), |
| 219 | 'description' => __( 'Handle products settings', 'yaymail' ), |
| 220 | ], |
| 221 | 'products_per_row' => [ |
| 222 | 'value_path' => 'products_per_row', |
| 223 | 'component' => 'NumberInput', |
| 224 | 'title' => __( 'Products per row', 'yaymail' ), |
| 225 | 'default_value' => isset( $attributes['products_per_row'] ) ? $attributes['products_per_row'] : '3', |
| 226 | 'min' => 1, |
| 227 | 'max' => 3, |
| 228 | 'type' => 'content', |
| 229 | ], |
| 230 | 'linked_products_type' => [ |
| 231 | 'value_path' => 'linked_products_type', |
| 232 | 'component' => 'Selector', |
| 233 | 'title' => __( 'Linked products type', 'yaymail' ), |
| 234 | 'default_value' => isset( $attributes['linked_products_type'] ) ? $attributes['linked_products_type'] : 'cross_sells', |
| 235 | 'type' => 'content', |
| 236 | 'options' => [ |
| 237 | [ |
| 238 | 'label' => __( 'Cross-sells', 'yaymail' ), |
| 239 | 'value' => 'cross_sells', |
| 240 | ], |
| 241 | [ |
| 242 | 'label' => __( 'Upsells', 'yaymail' ), |
| 243 | 'value' => 'up_sells', |
| 244 | ], |
| 245 | ], |
| 246 | ], |
| 247 | |
| 248 | 'max_products_displayed' => [ |
| 249 | 'value_path' => 'max_products_displayed', |
| 250 | 'component' => 'NumberInput', |
| 251 | 'title' => __( 'Max products displayed', 'yaymail' ), |
| 252 | 'default_value' => isset( $attributes['max_products_displayed'] ) ? $attributes['max_products_displayed'] : '5', |
| 253 | 'type' => 'content', |
| 254 | 'min' => 1, |
| 255 | 'max' => 20, |
| 256 | 'is_debounce' => true, |
| 257 | ], |
| 258 | ], |
| 259 | ]; |
| 260 | } |
| 261 | } |