Changeset 3449341
- Timestamp:
- 01/29/2026 08:14:16 AM (2 months ago)
- Location:
- simpler-checkout
- Files:
-
- 4 added
- 26 edited
- 1 copied
-
tags/1.3.2 (copied) (copied from simpler-checkout/trunk)
-
tags/1.3.2/README.txt (modified) (2 diffs)
-
tags/1.3.2/includes/Compatibility/skroutz-slm.php (added)
-
tags/1.3.2/includes/Models/Order.php (modified) (4 diffs)
-
tags/1.3.2/includes/Models/PickupPoint.php (added)
-
tags/1.3.2/includes/Services/OrderService.php (modified) (4 diffs)
-
tags/1.3.2/includes/Services/ProductFeedService.php (modified) (5 diffs)
-
tags/1.3.2/includes/button.php (modified) (6 diffs)
-
tags/1.3.2/includes/compat.php (modified) (1 diff)
-
tags/1.3.2/includes/constants.php (modified) (1 diff)
-
tags/1.3.2/simpler.php (modified) (1 diff)
-
tags/1.3.2/vendor/autoload.php (modified) (1 diff)
-
tags/1.3.2/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/1.3.2/vendor/composer/autoload_real.php (modified) (3 diffs)
-
tags/1.3.2/vendor/composer/autoload_static.php (modified) (3 diffs)
-
tags/1.3.2/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/includes/Compatibility/skroutz-slm.php (added)
-
trunk/includes/Models/Order.php (modified) (4 diffs)
-
trunk/includes/Models/PickupPoint.php (added)
-
trunk/includes/Services/OrderService.php (modified) (4 diffs)
-
trunk/includes/Services/ProductFeedService.php (modified) (5 diffs)
-
trunk/includes/button.php (modified) (6 diffs)
-
trunk/includes/compat.php (modified) (1 diff)
-
trunk/includes/constants.php (modified) (1 diff)
-
trunk/simpler.php (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simpler-checkout/tags/1.3.2/README.txt
r3437538 r3449341 5 5 Tested up to: 6.5 6 6 Requires PHP: 7.0 7 Stable tag: 1.3. 17 Stable tag: 1.3.2 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 35 35 36 36 == Changelog == 37 38 == 1.3.2 39 Feat: handle grouped products 40 Fix: normalize option keys in product feed 41 Fix: handle stock status in product feed 42 Compat: Skroutz Lockers 37 43 38 44 == 1.3.1 -
simpler-checkout/tags/1.3.2/includes/Models/Order.php
r3272319 r3449341 38 38 */ 39 39 private $addons; 40 /** 41 * @var PickupPoint 42 */ 43 private $pickupPoint; 40 44 41 public function __construct($simpler_cart_id, $currency, $shipping, $coupon, $simpler_discount, array $cart, $paymentMethod = null, $addons = null )45 public function __construct($simpler_cart_id, $currency, $shipping, $coupon, $simpler_discount, array $cart, $paymentMethod = null, $addons = null, $pickupPoint = null) 42 46 { 43 47 $this->simpler_cart_id = $simpler_cart_id; … … 49 53 $this->paymentMethod = $paymentMethod; 50 54 $this->addons = $addons; 55 $this->pickupPoint = $pickupPoint; 51 56 } 52 57 … … 78 83 $items, 79 84 isset($json['payment']) ? PaymentMethod::from_json($json['payment']) : null, 80 isset($json['addons']) ? $json['addons'] : null 85 isset($json['addons']) ? $json['addons'] : null, 86 isset($json['pickup_point']) ? PickupPoint::from_json($json['pickup_point']) : null 81 87 ); 82 88 } … … 121 127 return $this->addons; 122 128 } 129 130 /** 131 * @return PickupPoint 132 */ 133 public function get_pickup_point() 134 { 135 return $this->pickupPoint; 136 } 123 137 } -
simpler-checkout/tags/1.3.2/includes/Services/OrderService.php
r3417395 r3449341 87 87 88 88 \WC()->checkout()->set_data_from_cart($order); 89 if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '10.3.0', '>=' )) {89 if (defined('WC_VERSION') && version_compare(WC_VERSION, '10.3.0', '>=')) { 90 90 if (!empty($chosen_shipping_methods)) { 91 91 foreach (\WC()->shipping->get_packages() as $package_key => $package) { … … 96 96 $item->set_method_title($shipping_rate->label); 97 97 $item->set_method_id($shipping_rate->id); 98 $item->set_total($shipping_rate->cost); 98 $item->set_total($shipping_rate->cost); 99 99 $item->set_taxes($shipping_rate->taxes); 100 100 $order->add_item($item); … … 184 184 } 185 185 186 if (in_array($coupon, WC()->cart->get_applied_coupons())) {186 if (in_array($coupon, WC()->cart->get_applied_coupons())) { 187 187 return; 188 188 } … … 206 206 $this->addFeeTaxesActionClosure = function ($taxes, $fee) use ($tax) { 207 207 if ($fee->object->name == 'Simpler Discount') { 208 $fee->taxes = [- ($tax * 100)];208 $fee->taxes = [- ($tax * 100)]; 209 209 return $fee->taxes; 210 210 } -
simpler-checkout/tags/1.3.2/includes/Services/ProductFeedService.php
r3437538 r3449341 73 73 'price_cents' => $price_cents, 74 74 'shippable' => $product->needs_shipping(), 75 'stock' => (int) $product->get_stock_quantity(),75 'stock' => $this->get_stock_for_feed($product), 76 76 'url' => $product->get_permalink(), 77 77 'categories' => $cats, … … 87 87 88 88 $variations = $product->get_available_variations(); 89 foreach ($variations as $v _data) {90 $v _obj = wc_get_product($v_data['variation_id']);91 if ($v _obj) {92 $data['variations'][] = $this->transform_variation($v _obj);89 foreach ($variations as $variation) { 90 $v = wc_get_product($variation['variation_id']); 91 if ($v) { 92 $data['variations'][] = $this->transform_variation($v); 93 93 } 94 94 } 95 95 } else { 96 $attributes = $this->get_attributes_map($product);97 $data['attributes'] = empty($attributes) ? (object) [] : $attributes;96 $attributes = $this->get_attributes_map($product); 97 $data['attributes'] = empty($attributes) ? (object) [] : $attributes; 98 98 } 99 99 … … 117 117 'price_cents' => $price_cents, 118 118 'shippable' => $variation->needs_shipping(), 119 'stock' => (int) $variation->get_stock_quantity(),119 'stock' => $this->get_stock_for_feed($variation), 120 120 'attributes' => $this->get_variation_attributes_map($variation), 121 121 ]; … … 155 155 156 156 $options[] = [ 157 'id' => (string) sanitize_title($name),157 'id' => $this->transformationService->getAttributeKey($name), 158 158 'title' => $label, 159 159 'values' => $values … … 167 167 $map = []; 168 168 foreach ($product->get_attributes() as $attribute) { 169 $key = $this->transformationService->getAttributeKey($attribute->get_name());170 $options = $this->transformationService->getAttributeOptions($attribute);169 $key = $this->transformationService->getAttributeKey($attribute->get_name()); 170 $options = $this->transformationService->getAttributeOptions($attribute); 171 171 172 // Map names for CSV-like string173 $map[$key] = implode(', ', array_column($options, 'name'));172 // Map names for CSV-like string 173 $map[$key] = implode(', ', array_column($options, 'name')); 174 174 } 175 175 return empty($map) ? [] : $map; 176 176 } 177 177 178 private function get_variation_attributes_map(\WC_Product_Variation $variation) : array178 private function get_variation_attributes_map(\WC_Product_Variation $variation) 179 179 { 180 180 $map = []; 181 181 foreach ($variation->get_attributes() as $name => $value) { 182 if (!$value) { 183 continue; 184 } 182 185 $key = $this->transformationService->getAttributeKey($name); 183 186 $map[$key] = (string) $value; 184 187 } 185 return empty($map) ? [] : $map; 188 return empty($map) ? (object) [] : $map; 189 } 190 191 private function get_stock_for_feed($product): int 192 { 193 if ($product->get_stock_status() === 'outofstock') { 194 return 0; 195 } 196 return $product->get_stock_quantity() ?? -1; 186 197 } 187 198 } -
simpler-checkout/tags/1.3.2/includes/button.php
r3290493 r3449341 19 19 function simplerwc_load_visual_hook_filters() 20 20 { 21 add_filter( 22 get_option('simplerwc_product_button_placement', 'woocommerce_after_add_to_cart_quantity'), 23 'simplerwc_add_checkout_after_main_content', 24 10 25 ); 26 21 $productHook = get_option('simplerwc_product_button_placement', 'woocommerce_after_add_to_cart_quantity'); 22 add_filter($productHook, 'simplerwc_add_checkout_after_main_content', 10); 23 24 // grouped products should only be added in this hook to avoid the button rendering >1 time 25 if ($productHook !== 'woocommerce_after_add_to_cart_button') { 26 add_filter('woocommerce_after_add_to_cart_button', 'simplerwc_add_checkout_for_grouped_product', 10); 27 } 28 27 29 if (simplerwc_is_takeover_enable()) { 28 30 return; … … 100 102 101 103 global $product; 104 if (\is_product()) { 105 $page_product = \wc_get_product(get_queried_object_id()); 106 if ($page_product && $page_product->is_type('grouped')) { 107 return; 108 } 109 } 110 102 111 if (apply_filters('simplerwc_should_render_product_button', true, $product)) { 103 112 echo simplerwc_button(get_option('simplerwc_product_button_placement'), simplerwc_prepare_product($product), SIMPLERWC_BTNPOS_PRODUCT_PAGE); 113 }; 114 } 115 116 function simplerwc_add_checkout_for_grouped_product() 117 { 118 if (!simplerwc_should_render_button()) { 119 return; 120 } 121 122 if (!get_option('simpler_auto_render_product_button')) { 123 return; 124 } 125 126 global $product; 127 if (!$product || !$product->is_type('grouped')) { 128 return; 129 } 130 if (apply_filters('simplerwc_should_render_product_button', true, $product)) { 131 echo simplerwc_button('woocommerce_after_add_to_cart_button', simplerwc_prepare_product($product), SIMPLERWC_BTNPOS_PRODUCT_PAGE); 104 132 }; 105 133 } … … 219 247 { 220 248 if ($bundle_type = apply_filters('simplerwc_product_is_bundle_container', false, $product)) { 221 return ['items' => [simplerwc_get_product_attributes($product,$bundle_type)] ]; 222 }else{ 223 return ['items' => [simplerwc_get_product_attributes($product)] ]; 224 } 249 return ['items' => [simplerwc_get_product_attributes($product, $bundle_type)]]; 250 } 251 252 if ($product->is_type('grouped')) { 253 $items = []; 254 foreach ($product->get_children() as $child_id) { 255 $child = wc_get_product($child_id); 256 if ($child && $child->is_purchasable() && $child->is_in_stock()) { 257 $items[] = simplerwc_get_product_attributes($child); 258 } 259 } 260 return ['items' => $items]; 261 } 262 263 return ['items' => [simplerwc_get_product_attributes($product)]]; 225 264 } 226 265 … … 248 287 $bundled_items = apply_filters('simplerwc_get_selected_cart_items_linked_to_the_bundle_cart_item', [], $cart, $cart_item, $bundle_type); 249 288 array_push($ret['items'], simplerwc_get_cart_item_attributes($cart_item, $bundled_items, $bundle_type)); 250 } else{289 } else { 251 290 array_push($ret['items'], simplerwc_get_cart_item_attributes($cart_item)); 252 291 } … … 273 312 * @param \WC_Product $product The product to extract information from 274 313 */ 275 function simplerwc_get_product_attributes($product, $bundle_type = null, $cart_item = null)314 function simplerwc_get_product_attributes($product, $bundle_type = null, $cart_item = null) 276 315 { 277 316 $attrs = [ … … 294 333 $attrs['attributes'] = apply_filters('simplerwc_button_get_product_attributes', $product->get_variation_attributes(), $product, $cart_item); 295 334 } 296 if ($bundle_type){335 if ($bundle_type) { 297 336 $attrs['bundle_type'] = $bundle_type; 298 $attrs['product_type'] = apply_filters('simplerwc_get_product_type_of_the_bundle', $product->get_type(), $bundle_type);337 $attrs['product_type'] = apply_filters('simplerwc_get_product_type_of_the_bundle', $product->get_type(), $bundle_type); 299 338 $attrs['bundle_configuration'] = []; 300 $bundled_products = apply_filters('simplerwc_get_all_products_linked_to_the_bundle_product', [], $product, $bundle_type);301 foreach ($bundled_products as $bundled_product){339 $bundled_products = apply_filters('simplerwc_get_all_products_linked_to_the_bundle_product', [], $product, $bundle_type); 340 foreach ($bundled_products as $bundled_product) { 302 341 $attrs['bundle_configuration'][strval($bundled_product->get_id())] = simplerwc_get_product_attributes($bundled_product); 303 342 } -
simpler-checkout/tags/1.3.2/includes/compat.php
r3358403 r3449341 10 10 include_once ('Compatibility/pickup.php'); 11 11 include_once ('Compatibility/tax.php'); 12 include_once ('Compatibility/skroutz-slm.php'); -
simpler-checkout/tags/1.3.2/includes/constants.php
r3437538 r3449341 1 1 <?php 2 2 3 const SIMPLERWC_VERSION = '1.3. 1';3 const SIMPLERWC_VERSION = '1.3.2'; 4 4 5 5 function simplerwc_get_sdk_uri() -
simpler-checkout/tags/1.3.2/simpler.php
r3437538 r3449341 8 8 * Description: Simpler Checkout lets your customers complete their purchases in seconds, with any payment method they want, in any device or browser and without a password. 9 9 * Tags: woocommerce, checkout, payments, conversion rate 10 * Version: 1.3. 110 * Version: 1.3.2 11 11 * Requires at least: 5.1 12 12 * Tested up to: 6.8.3 -
simpler-checkout/tags/1.3.2/vendor/autoload.php
r3437538 r3449341 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit a5a44e2e320b3930151b936d56111dbd::getLoader();7 return ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98::getLoader(); -
simpler-checkout/tags/1.3.2/vendor/composer/autoload_classmap.php
r3437538 r3449341 47 47 'Simpler\\Models\\OrderShipping' => $baseDir . '/includes/Models/OrderShipping.php', 48 48 'Simpler\\Models\\PaymentMethod' => $baseDir . '/includes/Models/PaymentMethod.php', 49 'Simpler\\Models\\PickupPoint' => $baseDir . '/includes/Models/PickupPoint.php', 49 50 'Simpler\\Models\\ProductAttribute' => $baseDir . '/includes/Models/ProductAttribute.php', 50 51 'Simpler\\Models\\Quotation' => $baseDir . '/includes/Models/Quotation.php', -
simpler-checkout/tags/1.3.2/vendor/composer/autoload_real.php
r3437538 r3449341 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit a5a44e2e320b3930151b936d56111dbd5 class ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit a5a44e2e320b3930151b936d56111dbd', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit a5a44e2e320b3930151b936d56111dbd', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit a5a44e2e320b3930151b936d56111dbd::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; -
simpler-checkout/tags/1.3.2/vendor/composer/autoload_static.php
r3437538 r3449341 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit a5a44e2e320b3930151b936d56111dbd7 class ComposerStaticInit675b812554ac035a2c0930ccfe45fc98 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 70 70 'Simpler\\Models\\OrderShipping' => __DIR__ . '/../..' . '/includes/Models/OrderShipping.php', 71 71 'Simpler\\Models\\PaymentMethod' => __DIR__ . '/../..' . '/includes/Models/PaymentMethod.php', 72 'Simpler\\Models\\PickupPoint' => __DIR__ . '/../..' . '/includes/Models/PickupPoint.php', 72 73 'Simpler\\Models\\ProductAttribute' => __DIR__ . '/../..' . '/includes/Models/ProductAttribute.php', 73 74 'Simpler\\Models\\Quotation' => __DIR__ . '/../..' . '/includes/Models/Quotation.php', … … 92 93 { 93 94 return \Closure::bind(function () use ($loader) { 94 $loader->prefixLengthsPsr4 = ComposerStaticInit a5a44e2e320b3930151b936d56111dbd::$prefixLengthsPsr4;95 $loader->prefixDirsPsr4 = ComposerStaticInit a5a44e2e320b3930151b936d56111dbd::$prefixDirsPsr4;96 $loader->classMap = ComposerStaticInit a5a44e2e320b3930151b936d56111dbd::$classMap;95 $loader->prefixLengthsPsr4 = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$prefixLengthsPsr4; 96 $loader->prefixDirsPsr4 = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$prefixDirsPsr4; 97 $loader->classMap = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$classMap; 97 98 98 99 }, null, ClassLoader::class); -
simpler-checkout/tags/1.3.2/vendor/composer/installed.php
r3437538 r3449341 1 1 <?php return array( 2 2 'root' => array( 3 'pretty_version' => '1.3. 1',4 'version' => '1.3. 1.0',3 'pretty_version' => '1.3.2', 4 'version' => '1.3.2.0', 5 5 'type' => 'wordpress-plugin', 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' bb3716a6afa9e2e353f9e9bdd1ba65ce44e673c0',8 'reference' => '30c2cdd0d19ecd7dfa2ab2616847646a3f8bd6aa', 9 9 'name' => 'simpler-checkout/woo', 10 10 'dev' => false, … … 12 12 'versions' => array( 13 13 'simpler-checkout/woo' => array( 14 'pretty_version' => '1.3. 1',15 'version' => '1.3. 1.0',14 'pretty_version' => '1.3.2', 15 'version' => '1.3.2.0', 16 16 'type' => 'wordpress-plugin', 17 17 'install_path' => __DIR__ . '/../../', 18 18 'aliases' => array(), 19 'reference' => ' bb3716a6afa9e2e353f9e9bdd1ba65ce44e673c0',19 'reference' => '30c2cdd0d19ecd7dfa2ab2616847646a3f8bd6aa', 20 20 'dev_requirement' => false, 21 21 ), -
simpler-checkout/trunk/README.txt
r3437538 r3449341 5 5 Tested up to: 6.5 6 6 Requires PHP: 7.0 7 Stable tag: 1.3. 17 Stable tag: 1.3.2 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 35 35 36 36 == Changelog == 37 38 == 1.3.2 39 Feat: handle grouped products 40 Fix: normalize option keys in product feed 41 Fix: handle stock status in product feed 42 Compat: Skroutz Lockers 37 43 38 44 == 1.3.1 -
simpler-checkout/trunk/includes/Models/Order.php
r3272319 r3449341 38 38 */ 39 39 private $addons; 40 /** 41 * @var PickupPoint 42 */ 43 private $pickupPoint; 40 44 41 public function __construct($simpler_cart_id, $currency, $shipping, $coupon, $simpler_discount, array $cart, $paymentMethod = null, $addons = null )45 public function __construct($simpler_cart_id, $currency, $shipping, $coupon, $simpler_discount, array $cart, $paymentMethod = null, $addons = null, $pickupPoint = null) 42 46 { 43 47 $this->simpler_cart_id = $simpler_cart_id; … … 49 53 $this->paymentMethod = $paymentMethod; 50 54 $this->addons = $addons; 55 $this->pickupPoint = $pickupPoint; 51 56 } 52 57 … … 78 83 $items, 79 84 isset($json['payment']) ? PaymentMethod::from_json($json['payment']) : null, 80 isset($json['addons']) ? $json['addons'] : null 85 isset($json['addons']) ? $json['addons'] : null, 86 isset($json['pickup_point']) ? PickupPoint::from_json($json['pickup_point']) : null 81 87 ); 82 88 } … … 121 127 return $this->addons; 122 128 } 129 130 /** 131 * @return PickupPoint 132 */ 133 public function get_pickup_point() 134 { 135 return $this->pickupPoint; 136 } 123 137 } -
simpler-checkout/trunk/includes/Services/OrderService.php
r3417395 r3449341 87 87 88 88 \WC()->checkout()->set_data_from_cart($order); 89 if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '10.3.0', '>=' )) {89 if (defined('WC_VERSION') && version_compare(WC_VERSION, '10.3.0', '>=')) { 90 90 if (!empty($chosen_shipping_methods)) { 91 91 foreach (\WC()->shipping->get_packages() as $package_key => $package) { … … 96 96 $item->set_method_title($shipping_rate->label); 97 97 $item->set_method_id($shipping_rate->id); 98 $item->set_total($shipping_rate->cost); 98 $item->set_total($shipping_rate->cost); 99 99 $item->set_taxes($shipping_rate->taxes); 100 100 $order->add_item($item); … … 184 184 } 185 185 186 if (in_array($coupon, WC()->cart->get_applied_coupons())) {186 if (in_array($coupon, WC()->cart->get_applied_coupons())) { 187 187 return; 188 188 } … … 206 206 $this->addFeeTaxesActionClosure = function ($taxes, $fee) use ($tax) { 207 207 if ($fee->object->name == 'Simpler Discount') { 208 $fee->taxes = [- ($tax * 100)];208 $fee->taxes = [- ($tax * 100)]; 209 209 return $fee->taxes; 210 210 } -
simpler-checkout/trunk/includes/Services/ProductFeedService.php
r3437538 r3449341 73 73 'price_cents' => $price_cents, 74 74 'shippable' => $product->needs_shipping(), 75 'stock' => (int) $product->get_stock_quantity(),75 'stock' => $this->get_stock_for_feed($product), 76 76 'url' => $product->get_permalink(), 77 77 'categories' => $cats, … … 87 87 88 88 $variations = $product->get_available_variations(); 89 foreach ($variations as $v _data) {90 $v _obj = wc_get_product($v_data['variation_id']);91 if ($v _obj) {92 $data['variations'][] = $this->transform_variation($v _obj);89 foreach ($variations as $variation) { 90 $v = wc_get_product($variation['variation_id']); 91 if ($v) { 92 $data['variations'][] = $this->transform_variation($v); 93 93 } 94 94 } 95 95 } else { 96 $attributes = $this->get_attributes_map($product);97 $data['attributes'] = empty($attributes) ? (object) [] : $attributes;96 $attributes = $this->get_attributes_map($product); 97 $data['attributes'] = empty($attributes) ? (object) [] : $attributes; 98 98 } 99 99 … … 117 117 'price_cents' => $price_cents, 118 118 'shippable' => $variation->needs_shipping(), 119 'stock' => (int) $variation->get_stock_quantity(),119 'stock' => $this->get_stock_for_feed($variation), 120 120 'attributes' => $this->get_variation_attributes_map($variation), 121 121 ]; … … 155 155 156 156 $options[] = [ 157 'id' => (string) sanitize_title($name),157 'id' => $this->transformationService->getAttributeKey($name), 158 158 'title' => $label, 159 159 'values' => $values … … 167 167 $map = []; 168 168 foreach ($product->get_attributes() as $attribute) { 169 $key = $this->transformationService->getAttributeKey($attribute->get_name());170 $options = $this->transformationService->getAttributeOptions($attribute);169 $key = $this->transformationService->getAttributeKey($attribute->get_name()); 170 $options = $this->transformationService->getAttributeOptions($attribute); 171 171 172 // Map names for CSV-like string173 $map[$key] = implode(', ', array_column($options, 'name'));172 // Map names for CSV-like string 173 $map[$key] = implode(', ', array_column($options, 'name')); 174 174 } 175 175 return empty($map) ? [] : $map; 176 176 } 177 177 178 private function get_variation_attributes_map(\WC_Product_Variation $variation) : array178 private function get_variation_attributes_map(\WC_Product_Variation $variation) 179 179 { 180 180 $map = []; 181 181 foreach ($variation->get_attributes() as $name => $value) { 182 if (!$value) { 183 continue; 184 } 182 185 $key = $this->transformationService->getAttributeKey($name); 183 186 $map[$key] = (string) $value; 184 187 } 185 return empty($map) ? [] : $map; 188 return empty($map) ? (object) [] : $map; 189 } 190 191 private function get_stock_for_feed($product): int 192 { 193 if ($product->get_stock_status() === 'outofstock') { 194 return 0; 195 } 196 return $product->get_stock_quantity() ?? -1; 186 197 } 187 198 } -
simpler-checkout/trunk/includes/button.php
r3290493 r3449341 19 19 function simplerwc_load_visual_hook_filters() 20 20 { 21 add_filter( 22 get_option('simplerwc_product_button_placement', 'woocommerce_after_add_to_cart_quantity'), 23 'simplerwc_add_checkout_after_main_content', 24 10 25 ); 26 21 $productHook = get_option('simplerwc_product_button_placement', 'woocommerce_after_add_to_cart_quantity'); 22 add_filter($productHook, 'simplerwc_add_checkout_after_main_content', 10); 23 24 // grouped products should only be added in this hook to avoid the button rendering >1 time 25 if ($productHook !== 'woocommerce_after_add_to_cart_button') { 26 add_filter('woocommerce_after_add_to_cart_button', 'simplerwc_add_checkout_for_grouped_product', 10); 27 } 28 27 29 if (simplerwc_is_takeover_enable()) { 28 30 return; … … 100 102 101 103 global $product; 104 if (\is_product()) { 105 $page_product = \wc_get_product(get_queried_object_id()); 106 if ($page_product && $page_product->is_type('grouped')) { 107 return; 108 } 109 } 110 102 111 if (apply_filters('simplerwc_should_render_product_button', true, $product)) { 103 112 echo simplerwc_button(get_option('simplerwc_product_button_placement'), simplerwc_prepare_product($product), SIMPLERWC_BTNPOS_PRODUCT_PAGE); 113 }; 114 } 115 116 function simplerwc_add_checkout_for_grouped_product() 117 { 118 if (!simplerwc_should_render_button()) { 119 return; 120 } 121 122 if (!get_option('simpler_auto_render_product_button')) { 123 return; 124 } 125 126 global $product; 127 if (!$product || !$product->is_type('grouped')) { 128 return; 129 } 130 if (apply_filters('simplerwc_should_render_product_button', true, $product)) { 131 echo simplerwc_button('woocommerce_after_add_to_cart_button', simplerwc_prepare_product($product), SIMPLERWC_BTNPOS_PRODUCT_PAGE); 104 132 }; 105 133 } … … 219 247 { 220 248 if ($bundle_type = apply_filters('simplerwc_product_is_bundle_container', false, $product)) { 221 return ['items' => [simplerwc_get_product_attributes($product,$bundle_type)] ]; 222 }else{ 223 return ['items' => [simplerwc_get_product_attributes($product)] ]; 224 } 249 return ['items' => [simplerwc_get_product_attributes($product, $bundle_type)]]; 250 } 251 252 if ($product->is_type('grouped')) { 253 $items = []; 254 foreach ($product->get_children() as $child_id) { 255 $child = wc_get_product($child_id); 256 if ($child && $child->is_purchasable() && $child->is_in_stock()) { 257 $items[] = simplerwc_get_product_attributes($child); 258 } 259 } 260 return ['items' => $items]; 261 } 262 263 return ['items' => [simplerwc_get_product_attributes($product)]]; 225 264 } 226 265 … … 248 287 $bundled_items = apply_filters('simplerwc_get_selected_cart_items_linked_to_the_bundle_cart_item', [], $cart, $cart_item, $bundle_type); 249 288 array_push($ret['items'], simplerwc_get_cart_item_attributes($cart_item, $bundled_items, $bundle_type)); 250 } else{289 } else { 251 290 array_push($ret['items'], simplerwc_get_cart_item_attributes($cart_item)); 252 291 } … … 273 312 * @param \WC_Product $product The product to extract information from 274 313 */ 275 function simplerwc_get_product_attributes($product, $bundle_type = null, $cart_item = null)314 function simplerwc_get_product_attributes($product, $bundle_type = null, $cart_item = null) 276 315 { 277 316 $attrs = [ … … 294 333 $attrs['attributes'] = apply_filters('simplerwc_button_get_product_attributes', $product->get_variation_attributes(), $product, $cart_item); 295 334 } 296 if ($bundle_type){335 if ($bundle_type) { 297 336 $attrs['bundle_type'] = $bundle_type; 298 $attrs['product_type'] = apply_filters('simplerwc_get_product_type_of_the_bundle', $product->get_type(), $bundle_type);337 $attrs['product_type'] = apply_filters('simplerwc_get_product_type_of_the_bundle', $product->get_type(), $bundle_type); 299 338 $attrs['bundle_configuration'] = []; 300 $bundled_products = apply_filters('simplerwc_get_all_products_linked_to_the_bundle_product', [], $product, $bundle_type);301 foreach ($bundled_products as $bundled_product){339 $bundled_products = apply_filters('simplerwc_get_all_products_linked_to_the_bundle_product', [], $product, $bundle_type); 340 foreach ($bundled_products as $bundled_product) { 302 341 $attrs['bundle_configuration'][strval($bundled_product->get_id())] = simplerwc_get_product_attributes($bundled_product); 303 342 } -
simpler-checkout/trunk/includes/compat.php
r3358403 r3449341 10 10 include_once ('Compatibility/pickup.php'); 11 11 include_once ('Compatibility/tax.php'); 12 include_once ('Compatibility/skroutz-slm.php'); -
simpler-checkout/trunk/includes/constants.php
r3437538 r3449341 1 1 <?php 2 2 3 const SIMPLERWC_VERSION = '1.3. 1';3 const SIMPLERWC_VERSION = '1.3.2'; 4 4 5 5 function simplerwc_get_sdk_uri() -
simpler-checkout/trunk/simpler.php
r3437538 r3449341 8 8 * Description: Simpler Checkout lets your customers complete their purchases in seconds, with any payment method they want, in any device or browser and without a password. 9 9 * Tags: woocommerce, checkout, payments, conversion rate 10 * Version: 1.3. 110 * Version: 1.3.2 11 11 * Requires at least: 5.1 12 12 * Tested up to: 6.8.3 -
simpler-checkout/trunk/vendor/autoload.php
r3437538 r3449341 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit a5a44e2e320b3930151b936d56111dbd::getLoader();7 return ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98::getLoader(); -
simpler-checkout/trunk/vendor/composer/autoload_classmap.php
r3437538 r3449341 47 47 'Simpler\\Models\\OrderShipping' => $baseDir . '/includes/Models/OrderShipping.php', 48 48 'Simpler\\Models\\PaymentMethod' => $baseDir . '/includes/Models/PaymentMethod.php', 49 'Simpler\\Models\\PickupPoint' => $baseDir . '/includes/Models/PickupPoint.php', 49 50 'Simpler\\Models\\ProductAttribute' => $baseDir . '/includes/Models/ProductAttribute.php', 50 51 'Simpler\\Models\\Quotation' => $baseDir . '/includes/Models/Quotation.php', -
simpler-checkout/trunk/vendor/composer/autoload_real.php
r3437538 r3449341 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit a5a44e2e320b3930151b936d56111dbd5 class ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit a5a44e2e320b3930151b936d56111dbd', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit a5a44e2e320b3930151b936d56111dbd', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit a5a44e2e320b3930151b936d56111dbd::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; -
simpler-checkout/trunk/vendor/composer/autoload_static.php
r3437538 r3449341 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit a5a44e2e320b3930151b936d56111dbd7 class ComposerStaticInit675b812554ac035a2c0930ccfe45fc98 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 70 70 'Simpler\\Models\\OrderShipping' => __DIR__ . '/../..' . '/includes/Models/OrderShipping.php', 71 71 'Simpler\\Models\\PaymentMethod' => __DIR__ . '/../..' . '/includes/Models/PaymentMethod.php', 72 'Simpler\\Models\\PickupPoint' => __DIR__ . '/../..' . '/includes/Models/PickupPoint.php', 72 73 'Simpler\\Models\\ProductAttribute' => __DIR__ . '/../..' . '/includes/Models/ProductAttribute.php', 73 74 'Simpler\\Models\\Quotation' => __DIR__ . '/../..' . '/includes/Models/Quotation.php', … … 92 93 { 93 94 return \Closure::bind(function () use ($loader) { 94 $loader->prefixLengthsPsr4 = ComposerStaticInit a5a44e2e320b3930151b936d56111dbd::$prefixLengthsPsr4;95 $loader->prefixDirsPsr4 = ComposerStaticInit a5a44e2e320b3930151b936d56111dbd::$prefixDirsPsr4;96 $loader->classMap = ComposerStaticInit a5a44e2e320b3930151b936d56111dbd::$classMap;95 $loader->prefixLengthsPsr4 = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$prefixLengthsPsr4; 96 $loader->prefixDirsPsr4 = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$prefixDirsPsr4; 97 $loader->classMap = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$classMap; 97 98 98 99 }, null, ClassLoader::class); -
simpler-checkout/trunk/vendor/composer/installed.php
r3437538 r3449341 1 1 <?php return array( 2 2 'root' => array( 3 'pretty_version' => '1.3. 1',4 'version' => '1.3. 1.0',3 'pretty_version' => '1.3.2', 4 'version' => '1.3.2.0', 5 5 'type' => 'wordpress-plugin', 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' bb3716a6afa9e2e353f9e9bdd1ba65ce44e673c0',8 'reference' => '30c2cdd0d19ecd7dfa2ab2616847646a3f8bd6aa', 9 9 'name' => 'simpler-checkout/woo', 10 10 'dev' => false, … … 12 12 'versions' => array( 13 13 'simpler-checkout/woo' => array( 14 'pretty_version' => '1.3. 1',15 'version' => '1.3. 1.0',14 'pretty_version' => '1.3.2', 15 'version' => '1.3.2.0', 16 16 'type' => 'wordpress-plugin', 17 17 'install_path' => __DIR__ . '/../../', 18 18 'aliases' => array(), 19 'reference' => ' bb3716a6afa9e2e353f9e9bdd1ba65ce44e673c0',19 'reference' => '30c2cdd0d19ecd7dfa2ab2616847646a3f8bd6aa', 20 20 'dev_requirement' => false, 21 21 ),
Note: See TracChangeset
for help on using the changeset viewer.