Changeset 3733669
- Timestamp:
- 10/08/2026 04:49:06 AM (2 weeks ago)
- Location:
- keyideas-jewelry-configurator
- Files:
-
- 3 edited
- 8 copied
-
tags/1.0.24 (copied) (copied from keyideas-jewelry-configurator/trunk )
-
tags/1.0.24/includes (copied) (copied from keyideas-jewelry-configurator/trunk/includes )
-
tags/1.0.24/includes/class-kijs-activator.php (copied) (copied from keyideas-jewelry-configurator/trunk/includes/class-kijs-activator.php )
-
tags/1.0.24/includes/class-kijs-admin.php (copied) (copied from keyideas-jewelry-configurator/trunk/includes/class-kijs-admin.php ) (7 diffs)
-
tags/1.0.24/includes/class-kijs-shortcode.php (copied) (copied from keyideas-jewelry-configurator/trunk/includes/class-kijs-shortcode.php )
-
tags/1.0.24/keyideas-jewelry-configurator.php (copied) (copied from keyideas-jewelry-configurator/trunk/keyideas-jewelry-configurator.php ) (1 diff)
-
tags/1.0.24/readme.txt (copied) (copied from keyideas-jewelry-configurator/trunk/readme.txt ) (2 diffs)
-
tags/1.0.24/uninstall.php (copied) (copied from keyideas-jewelry-configurator/trunk/uninstall.php )
-
trunk/includes/class-kijs-admin.php (modified) (7 diffs)
-
trunk/keyideas-jewelry-configurator.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
keyideas-jewelry-configurator/tags/1.0.24/includes/class-kijs-admin.php
r3720949 r3733669 444 444 } 445 445 446 private function has_uploaded_csv_file($field_name) { 447 return !empty($_FILES[$field_name]['tmp_name']); 448 } 449 446 450 private function build_preview_summary_message($summary) { 447 451 if (!is_array($summary) || empty($summary)) { … … 575 579 576 580 if ($pricing_action === 'import_v2_csv') { 577 $products = $this->validate_uploaded_csv_file('kijs_products_csv', 'products'); 578 $stones = $this->validate_uploaded_csv_file('kijs_stones_csv', 'stones'); 581 $products_url_input = isset($_POST['kijs_products_csv_url']) 582 ? trim((string) wp_unslash($_POST['kijs_products_csv_url'])) 583 : ''; 584 $stones_url_input = isset($_POST['kijs_stones_csv_url']) 585 ? trim((string) wp_unslash($_POST['kijs_stones_csv_url'])) 586 : ''; 587 $products_url = $products_url_input !== '' 588 ? $this->validate_pricing_url($products_url_input) 589 : ''; 590 $stones_url = $stones_url_input !== '' 591 ? $this->validate_pricing_url($stones_url_input) 592 : ''; 593 $products = $this->has_uploaded_csv_file('kijs_products_csv') 594 ? $this->validate_uploaded_csv_file('kijs_products_csv', 'products') 595 : null; 596 $stones = $this->has_uploaded_csv_file('kijs_stones_csv') 597 ? $this->validate_uploaded_csv_file('kijs_stones_csv', 'stones') 598 : null; 599 600 if (!$products && $products_url === '') { 601 throw new Exception('Provide a products CSV URL or upload the products CSV file.'); 602 } 603 604 if (!$stones && $stones_url === '') { 605 throw new Exception('Provide a stones CSV URL or upload the stones CSV file.'); 606 } 607 579 608 $store = $this->get_store_key(); 580 609 $token = $this->ensure_remote_token(); … … 583 612 'store' => $store, 584 613 'token' => $token, 585 'productsCsvText' => $products['csvText'], 586 'stonesCsvText' => $stones['csvText'], 614 'productsCsvText' => $products ? $products['csvText'] : '', 615 'stonesCsvText' => $stones ? $stones['csvText'] : '', 616 'productsUrl' => $products_url, 617 'stonesUrl' => $stones_url, 587 618 ]); 588 619 … … 595 626 'token' => $token, 596 627 'pricingData' => $preview['pricingData'], 628 'productsUrl' => $products_url, 629 'stonesUrl' => $stones_url, 597 630 ]); 631 632 if ($products_url !== '') { 633 update_option('kijs_products_pricing_url', $products_url); 634 } 635 636 if ($stones_url !== '') { 637 update_option('kijs_stones_pricing_url', $stones_url); 638 } 598 639 599 640 $message = 'Products and stones pricing imported successfully.'; … … 601 642 $this->set_admin_notice('success', $message); 602 643 $this->redirect_to_settings(); 644 } 645 646 if ($pricing_action === 'export_v2_products' || $pricing_action === 'export_v2_stones') { 647 $store = $this->get_store_key(); 648 $token = $this->ensure_remote_token(); 649 $type = $pricing_action === 'export_v2_products' ? 'products' : 'stones'; 650 $response = $this->remote_get('/api/wordpress/pricing-v2/export', [ 651 'store' => $store, 652 'token' => $token, 653 'type' => $type, 654 ]); 655 656 $filename = $store !== '' ? $store . '-ring-pricing-' . $type . '.csv' : 'ring-pricing-' . $type . '.csv'; 657 $content_type = !empty($response['content_type']) ? (string) $response['content_type'] : 'text/csv; charset=utf-8'; 658 659 nocache_headers(); 660 header('Content-Type: ' . $content_type); 661 header('Content-Disposition: attachment; filename="' . sanitize_file_name($filename) . '"'); 662 echo $response['body']; 663 exit; 603 664 } 604 665 … … 637 698 $store_key = $this->get_store_key(); 638 699 $saved_token = $this->get_saved_token(); 700 $saved_products_url = get_option('kijs_products_pricing_url', ''); 701 $saved_stones_url = get_option('kijs_stones_pricing_url', ''); 702 $api_base_url = $this->get_api_base_url(); 639 703 $notice = $this->consume_admin_notice(); 640 704 ?> … … 744 808 <td> 745 809 <p><strong>Products CSV</strong></p> 810 <p> 811 <a class="button button-secondary" href="<?php echo esc_url($api_base_url . '/api/common-admin/settings/sample-csv-v2?type=products'); ?>">Download sample</a> 812 <button type="submit" class="button button-secondary" name="kijs_pricing_action" value="export_v2_products">Export current products</button> 813 </p> 814 <label for="kijs_products_csv_url"><strong>Products CSV URL</strong></label> 815 <input type="url" id="kijs_products_csv_url" name="kijs_products_csv_url" class="regular-text" value="<?php echo esc_attr($saved_products_url); ?>" placeholder="https://example.com/products-pricing.csv"> 816 <p class="description">Use a public CSV URL or upload a file below.</p> 746 817 <input type="file" name="kijs_products_csv" accept=".csv,text/csv"> 747 <p class="description">Upload the product pricing CSV for this store.</p>748 818 749 819 <p><strong>Stones CSV</strong></p> 820 <p> 821 <a class="button button-secondary" href="<?php echo esc_url($api_base_url . '/api/common-admin/settings/sample-csv-v2?type=stones'); ?>">Download sample</a> 822 <button type="submit" class="button button-secondary" name="kijs_pricing_action" value="export_v2_stones">Export current stones</button> 823 </p> 824 <label for="kijs_stones_csv_url"><strong>Stones CSV URL</strong></label> 825 <input type="url" id="kijs_stones_csv_url" name="kijs_stones_csv_url" class="regular-text" value="<?php echo esc_attr($saved_stones_url); ?>" placeholder="https://example.com/stones-pricing.csv"> 826 <p class="description">Use a public CSV URL or upload a file below.</p> 750 827 <input type="file" name="kijs_stones_csv" accept=".csv,text/csv"> 751 <p class="description"> Upload the stone pricing CSV for this store. Both files are validated before anything is saved.</p>828 <p class="description">Both products and stones sources are validated before anything is saved. Maximum upload size: 2 MB per file.</p> 752 829 </td> 753 830 </tr> -
keyideas-jewelry-configurator/tags/1.0.24/keyideas-jewelry-configurator.php
r3720949 r3733669 4 4 * Author URI: https://www.keyideasinfotech.com/ 5 5 * Description: 3D jewelry configurator for WordPress and WooCommerce with ring and bracelet customization. 6 * Version: 1.0.2 36 * Version: 1.0.24 7 7 * Author: Keyideas 8 8 * License: GPL v2 or later -
keyideas-jewelry-configurator/tags/1.0.24/readme.txt
r3720949 r3733669 6 6 Tested up to: 6.9 7 7 Requires PHP: 7.4 8 Stable tag: 1.0.2 38 Stable tag: 1.0.24 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 290 290 == Changelog == 291 291 292 = 1.0.24 = 293 * Add V2 products and stones sample downloads, hosted CSV URL inputs, and current pricing exports to the WordPress settings page. 294 * Keep CSV upload fallback and existing pricing/frontend behavior unchanged. 295 292 296 = 1.0.23 = 293 297 * Update the pricing import UI to support separate products and stones CSV uploads for V2 pricing. -
keyideas-jewelry-configurator/trunk/includes/class-kijs-admin.php
r3720949 r3733669 444 444 } 445 445 446 private function has_uploaded_csv_file($field_name) { 447 return !empty($_FILES[$field_name]['tmp_name']); 448 } 449 446 450 private function build_preview_summary_message($summary) { 447 451 if (!is_array($summary) || empty($summary)) { … … 575 579 576 580 if ($pricing_action === 'import_v2_csv') { 577 $products = $this->validate_uploaded_csv_file('kijs_products_csv', 'products'); 578 $stones = $this->validate_uploaded_csv_file('kijs_stones_csv', 'stones'); 581 $products_url_input = isset($_POST['kijs_products_csv_url']) 582 ? trim((string) wp_unslash($_POST['kijs_products_csv_url'])) 583 : ''; 584 $stones_url_input = isset($_POST['kijs_stones_csv_url']) 585 ? trim((string) wp_unslash($_POST['kijs_stones_csv_url'])) 586 : ''; 587 $products_url = $products_url_input !== '' 588 ? $this->validate_pricing_url($products_url_input) 589 : ''; 590 $stones_url = $stones_url_input !== '' 591 ? $this->validate_pricing_url($stones_url_input) 592 : ''; 593 $products = $this->has_uploaded_csv_file('kijs_products_csv') 594 ? $this->validate_uploaded_csv_file('kijs_products_csv', 'products') 595 : null; 596 $stones = $this->has_uploaded_csv_file('kijs_stones_csv') 597 ? $this->validate_uploaded_csv_file('kijs_stones_csv', 'stones') 598 : null; 599 600 if (!$products && $products_url === '') { 601 throw new Exception('Provide a products CSV URL or upload the products CSV file.'); 602 } 603 604 if (!$stones && $stones_url === '') { 605 throw new Exception('Provide a stones CSV URL or upload the stones CSV file.'); 606 } 607 579 608 $store = $this->get_store_key(); 580 609 $token = $this->ensure_remote_token(); … … 583 612 'store' => $store, 584 613 'token' => $token, 585 'productsCsvText' => $products['csvText'], 586 'stonesCsvText' => $stones['csvText'], 614 'productsCsvText' => $products ? $products['csvText'] : '', 615 'stonesCsvText' => $stones ? $stones['csvText'] : '', 616 'productsUrl' => $products_url, 617 'stonesUrl' => $stones_url, 587 618 ]); 588 619 … … 595 626 'token' => $token, 596 627 'pricingData' => $preview['pricingData'], 628 'productsUrl' => $products_url, 629 'stonesUrl' => $stones_url, 597 630 ]); 631 632 if ($products_url !== '') { 633 update_option('kijs_products_pricing_url', $products_url); 634 } 635 636 if ($stones_url !== '') { 637 update_option('kijs_stones_pricing_url', $stones_url); 638 } 598 639 599 640 $message = 'Products and stones pricing imported successfully.'; … … 601 642 $this->set_admin_notice('success', $message); 602 643 $this->redirect_to_settings(); 644 } 645 646 if ($pricing_action === 'export_v2_products' || $pricing_action === 'export_v2_stones') { 647 $store = $this->get_store_key(); 648 $token = $this->ensure_remote_token(); 649 $type = $pricing_action === 'export_v2_products' ? 'products' : 'stones'; 650 $response = $this->remote_get('/api/wordpress/pricing-v2/export', [ 651 'store' => $store, 652 'token' => $token, 653 'type' => $type, 654 ]); 655 656 $filename = $store !== '' ? $store . '-ring-pricing-' . $type . '.csv' : 'ring-pricing-' . $type . '.csv'; 657 $content_type = !empty($response['content_type']) ? (string) $response['content_type'] : 'text/csv; charset=utf-8'; 658 659 nocache_headers(); 660 header('Content-Type: ' . $content_type); 661 header('Content-Disposition: attachment; filename="' . sanitize_file_name($filename) . '"'); 662 echo $response['body']; 663 exit; 603 664 } 604 665 … … 637 698 $store_key = $this->get_store_key(); 638 699 $saved_token = $this->get_saved_token(); 700 $saved_products_url = get_option('kijs_products_pricing_url', ''); 701 $saved_stones_url = get_option('kijs_stones_pricing_url', ''); 702 $api_base_url = $this->get_api_base_url(); 639 703 $notice = $this->consume_admin_notice(); 640 704 ?> … … 744 808 <td> 745 809 <p><strong>Products CSV</strong></p> 810 <p> 811 <a class="button button-secondary" href="<?php echo esc_url($api_base_url . '/api/common-admin/settings/sample-csv-v2?type=products'); ?>">Download sample</a> 812 <button type="submit" class="button button-secondary" name="kijs_pricing_action" value="export_v2_products">Export current products</button> 813 </p> 814 <label for="kijs_products_csv_url"><strong>Products CSV URL</strong></label> 815 <input type="url" id="kijs_products_csv_url" name="kijs_products_csv_url" class="regular-text" value="<?php echo esc_attr($saved_products_url); ?>" placeholder="https://example.com/products-pricing.csv"> 816 <p class="description">Use a public CSV URL or upload a file below.</p> 746 817 <input type="file" name="kijs_products_csv" accept=".csv,text/csv"> 747 <p class="description">Upload the product pricing CSV for this store.</p>748 818 749 819 <p><strong>Stones CSV</strong></p> 820 <p> 821 <a class="button button-secondary" href="<?php echo esc_url($api_base_url . '/api/common-admin/settings/sample-csv-v2?type=stones'); ?>">Download sample</a> 822 <button type="submit" class="button button-secondary" name="kijs_pricing_action" value="export_v2_stones">Export current stones</button> 823 </p> 824 <label for="kijs_stones_csv_url"><strong>Stones CSV URL</strong></label> 825 <input type="url" id="kijs_stones_csv_url" name="kijs_stones_csv_url" class="regular-text" value="<?php echo esc_attr($saved_stones_url); ?>" placeholder="https://example.com/stones-pricing.csv"> 826 <p class="description">Use a public CSV URL or upload a file below.</p> 750 827 <input type="file" name="kijs_stones_csv" accept=".csv,text/csv"> 751 <p class="description"> Upload the stone pricing CSV for this store. Both files are validated before anything is saved.</p>828 <p class="description">Both products and stones sources are validated before anything is saved. Maximum upload size: 2 MB per file.</p> 752 829 </td> 753 830 </tr> -
keyideas-jewelry-configurator/trunk/keyideas-jewelry-configurator.php
r3720949 r3733669 4 4 * Author URI: https://www.keyideasinfotech.com/ 5 5 * Description: 3D jewelry configurator for WordPress and WooCommerce with ring and bracelet customization. 6 * Version: 1.0.2 36 * Version: 1.0.24 7 7 * Author: Keyideas 8 8 * License: GPL v2 or later -
keyideas-jewelry-configurator/trunk/readme.txt
r3720949 r3733669 6 6 Tested up to: 6.9 7 7 Requires PHP: 7.4 8 Stable tag: 1.0.2 38 Stable tag: 1.0.24 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 290 290 == Changelog == 291 291 292 = 1.0.24 = 293 * Add V2 products and stones sample downloads, hosted CSV URL inputs, and current pricing exports to the WordPress settings page. 294 * Keep CSV upload fallback and existing pricing/frontend behavior unchanged. 295 292 296 = 1.0.23 = 293 297 * Update the pricing import UI to support separate products and stones CSV uploads for V2 pricing.
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)