Changeset 3256919
- Timestamp:
- 03/17/2025 07:26:28 AM (11 months ago)
- Location:
- products-wizard-lite-for-woocommerce/trunk
- Files:
-
- 6 edited
-
includes/classes/Cart.php (modified) (2 diffs)
-
includes/classes/Core.php (modified) (2 diffs)
-
includes/classes/Form.php (modified) (41 diffs)
-
includes/classes/Traits/Settings.php (modified) (2 diffs)
-
products-wizard-lite-for-woocommerce.php (modified) (2 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
products-wizard-lite-for-woocommerce/trunk/includes/classes/Cart.php
r3252167 r3256919 10 10 * 11 11 * @class Cart 12 * @version 9.1. 012 * @version 9.1.1 13 13 */ 14 14 class Cart … … 283 283 284 284 return apply_filters('wcpw_cart_categories_ids', $output, $wizardId, $args); 285 }286 287 /**288 * Get cart products attribute values289 *290 * @param integer $wizardId291 * @param string $attribute292 * @param array $args293 *294 * @return array295 */296 public static function getAttributeValues($wizardId, $attribute, $args = [])297 {298 $output = [];299 300 // unified workflow301 if (substr($attribute, 0, strlen('pa_')) == 'pa_') {302 $attribute = substr($attribute, strlen('pa_'));303 }304 305 foreach (self::get($wizardId, $args) as $cartItem) {306 if (!isset($cartItem['product_id'])) {307 continue;308 }309 310 if (!empty($cartItem['variation_id'])311 && ($variation = wc_get_product($cartItem['variation_id'])) && !empty($variation)312 && ($variationAttribute = $variation->get_attribute($attribute)) && !empty($variationAttribute)313 && ($variationTerm = DataBase\Term::get($variationAttribute, "pa_$attribute", 'name')) && !empty($variationTerm)314 ) {315 // try to define specific variation attribute value316 $output[] = $variationTerm->term_id;317 } else {318 // just get all product attribute values319 $output = array_merge(320 $output,321 Product::getTermsIds($cartItem['product_id'], ['taxonomy' => "pa_$attribute", 'all' => false])322 );323 }324 }325 326 $output = array_unique($output);327 328 return apply_filters('wcpw_cart_attribute_values', $output, $wizardId, $attribute, $args);329 285 } 330 286 -
products-wizard-lite-for-woocommerce/trunk/includes/classes/Core.php
r3252167 r3256919 6 6 * 7 7 * @class Core 8 * @version 13.1. 08 * @version 13.1.1 9 9 */ 10 10 class Core … … 136 136 137 137 foreach ($requiredClasses as $requiredClass) { 138 if (!class_exists( '\\WCProductsWizard\\'. $requiredClass)138 if (!class_exists(__NAMESPACE__ . $requiredClass) 139 139 && file_exists(__DIR__ . DIRECTORY_SEPARATOR . $requiredClass . '.php') 140 140 ) { -
products-wizard-lite-for-woocommerce/trunk/includes/classes/Form.php
r3252167 r3256919 2 2 namespace WCProductsWizard; 3 3 4 use Exception;5 4 use WCProductsWizard\Entities\Product; 6 5 use WCProductsWizard\Entities\Wizard; … … 11 10 * 12 11 * @class Form 13 * @version 8.5. 012 * @version 8.5.1 14 13 */ 15 14 class Form … … 150 149 self::requestStep($request); 151 150 } 152 } catch ( Exception $exception) {151 } catch (\Exception $exception) { 153 152 $this->addNotice( 154 153 $exception->getCode() ?: self::getActiveStepId($request['id']), … … 195 194 * Add error notice and reply with the form HTML 196 195 * 197 * @param Exception $exception196 * @param \Exception $exception 198 197 * @param array $postData 199 198 * @param string $view - view template to output … … 332 331 * @param string $stepId 333 332 * 334 * @throws Exception333 * @throws \Exception 335 334 */ 336 335 public static function checkStepRules($args, $stepId) … … 377 376 $message = Wizard::getMinimumProductsSelectedMessage($args['id'], $value, $selectedCount); 378 377 379 throw new Exception(wp_kses_post($message), (int) $stepId);378 throw new \Exception(wp_kses_post($message), (int) $stepId); 380 379 } 381 380 } … … 392 391 $message = Wizard::getMaximumProductsSelectedMessage($args['id'], $value, $selectedCount); 393 392 394 throw new Exception(wp_kses_post($message), (int) $stepId);393 throw new \Exception(wp_kses_post($message), (int) $stepId); 395 394 } 396 395 } … … 407 406 $message = Wizard::getMinimumProductsSelectedMessage($args['id'], $value, $totalQuantity); 408 407 409 throw new Exception(wp_kses_post($message), (int) $stepId);408 throw new \Exception(wp_kses_post($message), (int) $stepId); 410 409 } 411 410 } … … 422 421 $message = Wizard::getMaximumProductsSelectedMessage($args['id'], $value, $totalQuantity); 423 422 424 throw new Exception(wp_kses_post($message), (int) $stepId);423 throw new \Exception(wp_kses_post($message), (int) $stepId); 425 424 } 426 425 } … … 433 432 * @param array $args 434 433 * 435 * @throws Exception434 * @throws \Exception 436 435 */ 437 436 public static function checkNonce($args = []) … … 445 444 446 445 if (empty($args['nonce']) || !wp_verify_nonce($args['nonce'], 'wcpw')) { 447 throw new Exception(wp_kses_post('Nonce error. Please, try to refresh the page.'), (int) $args['step_id']);446 throw new \Exception(wp_kses_post('Nonce error. Please, try to refresh the page.'), (int) $args['step_id']); 448 447 } 449 448 } … … 455 454 * @param array $cart 456 455 * 457 * @throws Exception456 * @throws \Exception 458 457 */ 459 458 public static function checkCartRules($args, $cart) … … 493 492 $message = Wizard::getMinimumProductsSelectedMessage($id, $limit, $productsSelectedCount); 494 493 495 throw new Exception(wp_kses_post($message));494 throw new \Exception(wp_kses_post($message)); 496 495 } 497 496 … … 502 501 $message = Wizard::getMaximumProductsSelectedMessage($id, $limit, $productsSelectedCount); 503 502 504 throw new Exception(wp_kses_post($message));503 throw new \Exception(wp_kses_post($message)); 505 504 } 506 505 … … 511 510 $message = Wizard::getMinimumProductsSelectedMessage($id, $limit, $totalProductsQuantity); 512 511 513 throw new Exception(wp_kses_post($message));512 throw new \Exception(wp_kses_post($message)); 514 513 } 515 514 … … 520 519 $message = Wizard::getMaximumProductsSelectedMessage($id, $limit, $totalProductsQuantity); 521 520 522 throw new Exception(wp_kses_post($message));521 throw new \Exception(wp_kses_post($message)); 523 522 } 524 523 } … … 570 569 * @return boolean 571 570 * 572 * @throws Exception571 * @throws \Exception 573 572 */ 574 573 public static function submit($args) … … 740 739 741 740 Cart::addProduct($args['id'], apply_filters('wcpw_submit_form_item_data', $data, $args)); 742 } catch ( Exception $exception) {743 throw new Exception(wp_kses_post($exception->getMessage()), (int) $data['step_id']);741 } catch (\Exception $exception) { 742 throw new \Exception(wp_kses_post($exception->getMessage()), (int) $data['step_id']); 744 743 } 745 744 } … … 770 769 self::submit($postData); 771 770 $this->ajaxReplyHandler($postData); 772 } catch ( Exception $exception) {771 } catch (\Exception $exception) { 773 772 $this->ajaxErrorHandler($exception, $postData); 774 773 } … … 782 781 * @return array - products added with keys 783 782 * 784 * @throws Exception783 * @throws \Exception 785 784 */ 786 785 public static function addToMainCart($args) … … 975 974 976 975 foreach (wc_get_notices('error') as $notice) { 977 throw new Exception(get_the_title($productData['product_id']) . ': ' . $notice['notice']);976 throw new \Exception(get_the_title($productData['product_id']) . ': ' . $notice['notice']); 978 977 } 979 978 } 980 } catch ( Exception $exception) {979 } catch (\Exception $exception) { 981 980 // drop all added products in case of exception 982 981 foreach (array_keys($output) as $outputKey) { … … 984 983 } 985 984 986 throw new Exception(wp_kses_post($exception->getMessage()));985 throw new \Exception(wp_kses_post($exception->getMessage())); 987 986 } 988 987 } … … 1017 1016 ] 1018 1017 ); 1019 } catch ( Exception $exception) {1018 } catch (\Exception $exception) { 1020 1019 $this->ajaxErrorHandler($exception, $postData); 1021 1020 } … … 1027 1026 * @param array $args 1028 1027 * 1029 * @throws Exception1028 * @throws \Exception 1030 1029 */ 1031 1030 public static function requestStep($args) … … 1075 1074 self::requestStep($postData); 1076 1075 $this->ajaxReplyHandler($postData); 1077 } catch ( Exception $exception) {1076 } catch (\Exception $exception) { 1078 1077 $this->ajaxErrorHandler($exception, $postData); 1079 1078 } … … 1088 1087 self::requestStep($postData); 1089 1088 $this->ajaxReplyHandler($postData, [], 'body/step/index'); 1090 } catch ( Exception $exception) {1089 } catch (\Exception $exception) { 1091 1090 $this->ajaxErrorHandler($exception, $postData); 1092 1091 } … … 1098 1097 * @param array $args 1099 1098 * 1100 * @throws Exception1099 * @throws \Exception 1101 1100 */ 1102 1101 public static function skipStep($args) … … 1120 1119 self::skipStep($postData); 1121 1120 $this->ajaxReplyHandler($postData); 1122 } catch ( Exception $exception) {1121 } catch (\Exception $exception) { 1123 1122 $this->ajaxErrorHandler($exception, $postData); 1124 1123 } … … 1130 1129 * @param array $args 1131 1130 * 1132 * @throws Exception1131 * @throws \Exception 1133 1132 */ 1134 1133 public static function submitAndSkipAll($args) … … 1157 1156 self::submitAndSkipAll($postData); 1158 1157 $this->ajaxReplyHandler($postData); 1159 } catch ( Exception $exception) {1158 } catch (\Exception $exception) { 1160 1159 $this->ajaxErrorHandler($exception, $postData); 1161 1160 } … … 1167 1166 * @param array $args 1168 1167 * 1169 * @throws Exception1168 * @throws \Exception 1170 1169 */ 1171 1170 public static function skipAll($args) … … 1191 1190 self::skipAll($postData); 1192 1191 $this->ajaxReplyHandler($postData); 1193 } catch ( Exception $exception) {1192 } catch (\Exception $exception) { 1194 1193 $this->ajaxErrorHandler($exception, $postData); 1195 1194 } … … 1201 1200 * @param array $args 1202 1201 * 1203 * @throws Exception1202 * @throws \Exception 1204 1203 */ 1205 1204 public static function reset($args) … … 1228 1227 self::reset($postData); 1229 1228 $this->ajaxReplyHandler($postData); 1230 } catch ( Exception $exception) {1229 } catch (\Exception $exception) { 1231 1230 $this->ajaxErrorHandler($exception, $postData); 1232 1231 } … … 1242 1241 * @return boolean|array 1243 1242 * 1244 * @throws Exception1243 * @throws \Exception 1245 1244 */ 1246 1245 public static function addCartProduct($args) … … 1286 1285 * Add product to the cart via ajax 1287 1286 * 1288 * @throws Exception1287 * @throws \Exception 1289 1288 */ 1290 1289 public function addCartProductAjax() … … 1295 1294 self::addCartProduct($postData); 1296 1295 $this->ajaxReplyHandler($postData); 1297 } catch ( Exception $exception) {1296 } catch (\Exception $exception) { 1298 1297 $this->ajaxErrorHandler($exception, $postData); 1299 1298 } … … 1305 1304 * @param array $args 1306 1305 * 1307 * @throws Exception1306 * @throws \Exception 1308 1307 */ 1309 1308 public static function removeCartProduct($args) … … 1355 1354 self::removeCartProduct($postData); 1356 1355 $this->ajaxReplyHandler($postData); 1357 } catch ( Exception $exception) {1356 } catch (\Exception $exception) { 1358 1357 $this->ajaxErrorHandler($exception, $postData); 1359 1358 } … … 1367 1366 * @return boolean 1368 1367 * 1369 * @throws Exception1368 * @throws \Exception 1370 1369 */ 1371 1370 public static function updateCartProduct($args) … … 1395 1394 self::updateCartProduct($postData); 1396 1395 $this->ajaxReplyHandler($postData); 1397 } catch ( Exception $exception) {1396 } catch (\Exception $exception) { 1398 1397 $this->ajaxErrorHandler($exception, $postData); 1399 1398 } -
products-wizard-lite-for-woocommerce/trunk/includes/classes/Traits/Settings.php
r3251255 r3256919 2 2 namespace WCProductsWizard\Traits; 3 3 4 use WCProductsWizard\DataBase;5 4 use WCProductsWizard\Utils; 6 5 … … 8 7 * Entity with settings trait 9 8 * 10 * @version 1.0. 09 * @version 1.0.1 11 10 * 12 11 * @property string $namespace -
products-wizard-lite-for-woocommerce/trunk/products-wizard-lite-for-woocommerce.php
r3251255 r3256919 3 3 * Plugin Name: Products Wizard Lite for WooCommerce 4 4 * Description: This plugin helps you sell your WooCommerce products by the step-by-step wizard 5 * Version: 1.0. 15 * Version: 1.0.2 6 6 * Author: [email protected] 7 7 * Author URI: https://troll-winner.com/ … … 25 25 26 26 if (!defined('WC_PRODUCTS_WIZARD_VERSION')) { 27 define('WC_PRODUCTS_WIZARD_VERSION', '1.0. 1');27 define('WC_PRODUCTS_WIZARD_VERSION', '1.0.2'); 28 28 } 29 29 -
products-wizard-lite-for-woocommerce/trunk/readme.txt
r3252167 r3256919 7 7 WC requires at least: 2.4 8 8 WC tested up to: 9.5.2 9 Stable tag: 1.0. 19 Stable tag: 1.0.2 10 10 License: GPLv3 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 36 36 ### Use-cases for Your Shop 37 37 38 * Gift boxes39 * Software bundles40 * Personalized dishes41 * Customized services42 * Furniture configuration43 * Custom technics or mechanisms38 * 🎁 Gift boxes 39 * 🖥️ Software bundles 40 * 🍲 Personalized dishes 41 * 🛎️ Customized services 42 * 🛋️ Furniture configuration 43 * 🧰 Custom technics or mechanisms 44 44 45 45 ### Go PRO … … 47 47 Love products wizard, but want much more features and possibilities? Such as: 48 48 49 * More work modes and views50 * Creating order PDF51 * Custom input fields52 * Inner checkout step53 * Flexible discount rules54 * More powerful Min/Max product rules55 * More powerful availability rules56 * Pre-defined wizard state and products in cart57 * Thumbnail image generation58 * Attaching to a product page49 * 🛠 More work modes and views 50 * 🖹 Creating order PDF 51 * 📎 Custom input fields 52 * 💳 Inner checkout step 53 * 🛍️ Flexible discount rules 54 * 🛒 More powerful Min/Max product rules 55 * ↪️ More powerful availability rules 56 * 📦 Pre-defined wizard state and products in cart 57 * 🖼️ Thumbnail image generation 58 * 📌 Attaching to a product page 59 59 60 60 Don't hesitate to try the full PRO version of the plugin! … … 64 64 ### Technical Features 65 65 66 Full Asynchronous Workflow66 🔃 Full Asynchronous Workflow 67 67 : No excess page refreshes while using the wizard. 68 68 69 Responsive Design69 📱 Responsive Design 70 70 : Fits any device screen size. 71 71 72 Completely Internationalized73 : Translate any text string from the admin part. Also, plugin will outputelements correctly for any language and writing direction.72 🌐 Completely Internationalized 73 : Translate any text string from the admin part. Plugin outputs elements correctly for any language and writing direction. 74 74 75 Accessibility Friendly75 ♿ Accessibility Friendly 76 76 : Works comfortable for any type of devices and manipulators. 77 77 78 High-organized And Customizable Code78 💻 High-organized And Customizable Code 79 79 : Expand the wizard functionality with your own keeping the plugin pure and updatable. 80 80 81 Easy Templates Customization81 😎 Easy Templates Customization 82 82 : Customize the wizard HTML parts with no headache via the admin part. 83 83 84 Adopts Bootstrap-based Themes84 🇧 Adopts Bootstrap-based Themes 85 85 : The wizard can use your bootstrap-based theme style to be better integrated into your site. 86 86 87 Modern JavaScript Code88 : Clear ES6 modules code for development and bundled one for production.87 ⭐ Modern JavaScript Code 88 : Clear and reliable code without 3rd-party dependencies. 89 89 90 Works Without Javascript Even90 🦖 Works Without Javascript Even 91 91 : The wizard uses fail-safe technologies to work in any environment and situation. 92 92 93 No AI/GMO code93 🍀 No AI/GMO code 94 94 : All plugin code is carefully made by hand and not by accident. 95 95 … … 118 118 == Changelog == 119 119 120 = 1.0.2 = 121 Fix: Lost classes bug 122 120 123 = 1.0.1 = 121 124 Tweak: Code refactoring
Note: See TracChangeset
for help on using the changeset viewer.