Changeset 3200980
- Timestamp:
- 12/02/2024 02:23:41 PM (16 months ago)
- Location:
- bc-woo-custom-thank-you-pages/trunk
- Files:
-
- 4 edited
-
Initiator.php (modified) (7 diffs)
-
inc/Config.php (modified) (1 diff)
-
inc/Options_Name.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
bc-woo-custom-thank-you-pages/trunk/Initiator.php
r3180039 r3200980 5 5 * Plugin URI: https://www.binarycarpenter.com/app/bc-thank-you-page-builder-for-woocommerce/ 6 6 * Description: Helps you create custom thank you pages for products, categories 7 * Version: 1.4. 197 * Version: 1.4.20 8 8 * Author: WooCommerce & WordPress Tutorials 9 9 * Author URI: https://www.binarycarpenter.com 10 10 * License: GPL2 11 11 * Text Domain: bc-custom-thank-you 12 * Tested up to: 6. 6.2.12 * Tested up to: 6.7.1. 13 13 * WC requires at least: 3.0.0 14 * WC tested up to: 9. 3.314 * WC tested up to: 9.4.2 15 15 */ 16 16 … … 119 119 try { 120 120 $body = json_decode(wp_remote_retrieve_body($response)); 121 error_log("body is " . print_r($body, true));122 121 if (!isset($body->versionNumber)) { 123 122 error_log("error checking for new version for wp thank you page builder"); … … 215 214 $products = $order->get_items(); 216 215 217 $first_product = null; 218 //get the first product in cart to get its thank you page 219 foreach ($products as $product) { 220 $first_product = $product->get_data(); 216 $first_product_id = 0; 217 $first_product_variation_id = 0; 218 219 foreach ($products as $item_id => $item) { 220 // Product name 221 $product_name = $item->get_name(); 222 223 // Product ID 224 if (method_exists($item, 'get_product_id')) { 225 error_log("setting first product id to " . $item->get_product_id()); 226 $first_product_id = $item->get_product_id(); 227 } 228 229 // Variation ID (if applicable) 230 if (method_exists($item, 'get_variation_id')) { 231 error_log("setting first variation id to " . $item->get_variation_id()); 232 $first_product_variation_id = $item->get_variation_id(); 233 } 234 235 //log all the info 236 error_log("first product name: " . $product_name); 237 error_log("first product id: " . $first_product_id); 238 error_log("first variation id: " . $first_product_variation_id); 239 //only get the first product 221 240 break; 222 241 } 223 $first_product_id = $first_product['product_id'];224 242 225 243 … … 230 248 231 249 $product_thank_you_pages = $option->get_array(Oname::PER_PRODUCT_THANK_YOU_PAGE); 250 $product_variation_thank_you_pages = $option->get_array(Oname::PER_PRODUCT_VARIATION_THANK_YOU_PAGE); 232 251 $category_thank_you_pages = $option->get_array(Oname::PER_CATEGORY_THANK_YOU_PAGE); 233 252 … … 237 256 $product_cats_ids = $first_product->get_category_ids(); 238 257 239 //if the product has a specific thank you page set for it, then take that thank you page 240 if (isset($product_thank_you_pages["$first_product_id"])) { 258 //inspect the selected product 259 error_log("product id " . $first_product_id); 260 261 if (isset($product_variation_thank_you_pages["$first_product_variation_id"])) { 262 error_log("setting thank you page id to product variation " . $product_variation_thank_you_pages["$first_product_variation_id"]); 263 $thank_you_page_id = $product_variation_thank_you_pages["$first_product_variation_id"]; 264 } else if (isset($product_thank_you_pages["$first_product_id"])) { 265 error_log("setting thank you page id to product " . $product_thank_you_pages["$first_product_id"]); 241 266 $thank_you_page_id = $product_thank_you_pages["$first_product_id"]; 242 267 } else { … … 428 453 $products_select = array(); 429 454 455 $variations_select = array(); 456 430 457 foreach ($products as $product) { 458 459 //if the product has variable, add it to the list 460 if ($product->is_type('variable')) { 461 $children = $product->get_children($args = '', $output = OBJECT); 462 foreach ($children as $key => $value) { 463 $product_variatons = new \WC_Product_Variation($value); 464 if ($product_variatons->exists() && $product_variatons->variation_is_visible()) { 465 $variations[$value] = $product_variatons->get_variation_attributes(); 466 $variations_select[$value] = $product_variatons->get_name(); 467 } 468 } 469 } 431 470 432 471 $products_select[$product->get_id()] = $product->get_name(); … … 448 487 $option_form->key_select_select(Oname::PER_PRODUCT_THANK_YOU_PAGE, $products_select, $pages_select, 'Pick product', 'Pick thank you page', !Config::IS_PRO) 449 488 ), false); 489 490 $thank_you_tab[] = 491 $option_form->card_section('Specify thank you page per product variation', array( 492 $option_form->key_select_select(Oname::PER_PRODUCT_VARIATION_THANK_YOU_PAGE, $variations_select, $pages_select, 'Pick product', 'Pick thank you page', !Config::IS_PRO) 493 ), false); 494 495 450 496 //activation section 451 497 if (!Config::IS_PRO) { -
bc-woo-custom-thank-you-pages/trunk/inc/Config.php
r3180039 r3200980 21 21 const KEY_CHECK_OPTION = 'bc_woo_custom_tk_check_option_key'; 22 22 const LICENSE_KEY_OPTION = 'bc_woo_custom_tk_stored_license_key'; 23 const PLUGIN_VERSION_NUMBER = 11 5;23 const PLUGIN_VERSION_NUMBER = 116; 24 24 const OPTION_NAME = 'bc_menu_bar_cart_option_name'; 25 25 const IS_PRO = false; -
bc-woo-custom-thank-you-pages/trunk/inc/Options_Name.php
r3005287 r3200980 10 10 const PER_CATEGORY_THANK_YOU_PAGE = 'thank_you_page_per_category'; 11 11 const PER_PRODUCT_THANK_YOU_PAGE = 'thank_you_page_per_product'; 12 const PER_PRODUCT_VARIATION_THANK_YOU_PAGE = 'thank_you_page_per_product_variation'; 12 13 const SHOP_PAGE = 'shop_page'; 13 14 const CUSTOM_PAGES_PER_CATEGORY = 'custom_pages_per_category'; //setting the display page per category -
bc-woo-custom-thank-you-pages/trunk/readme.txt
r3180039 r3200980 7 7 WC tested up to: 9.0.2 8 8 Requires PHP: 5.3 9 Stable tag: 1.4. 199 Stable tag: 1.4.20 10 10 11 11 Create thank you pages for all products, per products or per category
Note: See TracChangeset
for help on using the changeset viewer.