Changeset 1229461
- Timestamp:
- 08/24/2015 06:39:25 PM (11 years ago)
- Location:
- thecartpress/trunk
- Files:
-
- 20 edited
-
TheCartPress.class.php (modified) (1 diff)
-
checkout/BillingBox.class.php (modified) (2 diffs)
-
checkout/ShippingBox.class.php (modified) (2 diffs)
-
classes/ShoppingCart.class.php (modified) (1 diff)
-
js/tcp_state_scripts.php (modified) (3 diffs)
-
modules/StockManagement.class.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
-
templates/tcp_template.php (modified) (2 diffs)
-
themes-templates/tcp_shopping_cart.php (modified) (1 diff)
-
widgets/ArchivesWidget.class.php (modified) (1 diff)
-
widgets/AttributesListWidget.class.php (modified) (1 diff)
-
widgets/BuyButtonWidget.class.php (modified) (1 diff)
-
widgets/CheckoutWidget.class.php (modified) (1 diff)
-
widgets/CommentsCustomPostTypeWidget.class.php (modified) (1 diff)
-
widgets/LoginWidget.class.php (modified) (1 diff)
-
widgets/SelectCountryWidget.class.php (modified) (1 diff)
-
widgets/ShoppingCartSummaryWidget.class.php (modified) (1 diff)
-
widgets/ShoppingCartWidget.class.php (modified) (1 diff)
-
widgets/SortPanelWidget.class.php (modified) (1 diff)
-
widgets/TCPParentWidget.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
thecartpress/trunk/TheCartPress.class.php
r1225478 r1229461 4 4 Plugin URI: http://thecartpress.com 5 5 Description: Professional WordPress eCommerce Plugin. Use it as Shopping Cart, Catalog or Framework. 6 Version: 1.4. 26 Version: 1.4.3 7 7 Author: Pluginsmaker team 8 8 Author URI: http://pluginsmaker.com/ -
thecartpress/trunk/checkout/BillingBox.class.php
r1152289 r1229461 78 78 $required = isset( $settings['required-' . $id] ) ? $settings['required-' . $id] : false; 79 79 if ( $required && ( ! isset( $_REQUEST[$id] ) || strlen( $_REQUEST[$id] ) == 0 ) ) { 80 81 // if not billing region id, take a look to region textbox 82 if ( $id == 'billing_region_id' ) { 83 if ( isset( $_REQUEST['billing_region'] ) && strlen( $_REQUEST['billing_region'] ) > 0 ) { 84 continue; 85 } 86 } 80 87 $this->errors[$id] = $field['error']; 81 88 } elseif ( $id == 'billing_country_id' ) { … … 568 575 } ?> 569 576 <label for="billing_region_id"><?php _e( 'Region', 'tcp' ); ?>:<?php if ( $required ) echo '<em>*</em>'; ?></label> 570 <?php $regions = apply_filters( 'tcp_load_regions_for_billing', false ); //array( 'id' => array( 'name'), 'id' => array( 'name'), ... ) ?> 577 <?php //array( 'id' => array( 'name'), 'id' => array( 'name'), ... ) 578 $regions = apply_filters( 'tcp_load_regions_for_billing', false ); 579 ?> 571 580 <select id="billing_region_id" name="billing_region_id" <?php if ( is_array( $regions ) && count( $regions ) > 0 ) {} else { echo 'style="display:none;"'; }?> class="form-control"> 572 581 <option value=""><?php _e( 'No state selected', 'tcp' ); ?></option> -
thecartpress/trunk/checkout/ShippingBox.class.php
r1152289 r1229461 71 71 $required = isset( $settings['required-' . $id] ) ? $settings['required-' . $id] : false; 72 72 if ( $required && ( ! isset( $_REQUEST[$id] ) || strlen( $_REQUEST[$id] ) == 0 ) ) { 73 74 // if not billing region id, take a look to region textbox 75 if ( $id == 'shipping_region_id' ) { 76 if ( isset( $_REQUEST['shipping_region'] ) && strlen( $_REQUEST['shipping_region'] ) > 0 ) { 77 continue; 78 } 79 } 73 80 $this->errors[$id] = $field['error']; 74 81 } elseif ( $id == 'shipping_country_id' ) { … … 533 540 } ?> 534 541 <label for="shipping_region_id"><?php _e( 'Region', 'tcp' ); ?>:<?php if ( $required ) echo '<em>*</em>'; ?></label> 535 <?php $regions = apply_filters( 'tcp_load_regions_for_shipping', false ); //array( 'id' => array( 'name'), 'id' => array( 'name'), ... ) ?> 542 <?php //array( 'id' => array( 'name'), 'id' => array( 'name'), ... ) 543 $regions = apply_filters( 'tcp_load_regions_for_shipping', false ); 544 ?> 536 545 <select id="shipping_region_id" name="shipping_region_id" <?php if ( is_array( $regions ) && count( $regions ) > 0 ) {} else { echo 'style="display:none;"'; }?> class="form-control"> 537 546 <option value=""><?php _e( 'No state selected', 'tcp' ); ?></option> -
thecartpress/trunk/classes/ShoppingCart.class.php
r1200296 r1229461 766 766 } 767 767 768 /** 769 * @deprecated deprecated since version 1.4.2 770 */ 768 771 function getOption1Id() { 769 772 return $this->option_1_id; 770 773 } 771 774 775 /** 776 * @deprecated deprecated since version 1.4.2 777 */ 772 778 function getOption2Id() { 773 779 return $this->option_2_id; -
thecartpress/trunk/js/tcp_state_scripts.php
r691701 r1229461 53 53 region_select.show(); 54 54 } 55 jQuery('#region').hide();//textbox 55 56 // Hides region textbox 57 jQuery('#region').hide(); 56 58 region_select.val(jQuery('#region_selected_id').val()); 57 59 } else { 58 jQuery('#region').show();//textbox 60 61 // Shows region textbox 62 jQuery('#region').show(); 59 63 region_select.hide(); 60 64 } 65 // Region textbox set to blank (always) 66 jQuery('#region').val(''); 61 67 }); 62 68 jQuery('#country_id').change(); … … 84 90 region_select.show(); 85 91 } 86 jQuery('#billing_region').hide();//textbox 92 93 // Hides region textbox 94 jQuery('#billing_region').hide(); 95 87 96 region_select.val(jQuery('#billing_region_selected_id').val()); 88 97 } else { 89 jQuery('#billing_region').show();//textbox 98 // Shows region textbox 99 jQuery('#billing_region').show(); 90 100 region_select.hide(); 91 101 } 102 // Region textbox set to blank 103 jQuery('#billing_region').val(''); 92 104 } ); 93 105 jQuery('#billing_country_id').change(); … … 116 128 region_select.show(); 117 129 } 118 jQuery('#shipping_region').hide();//textbox 130 131 // Hides region textbox 132 jQuery('#shipping_region').hide(); 119 133 region_select.val(jQuery('#shipping_region_selected_id').val()); 120 134 } else { 121 jQuery('#shipping_region').show();//textbox 135 // Shows region textbox 136 jQuery('#shipping_region').show(); 122 137 region_select.hide(); 123 138 } 139 140 // Region textbox set to blank 141 jQuery('#shipping_region').val(''); 124 142 }); 125 143 jQuery('#shipping_country_id').change(); -
thecartpress/trunk/modules/StockManagement.class.php
r1152289 r1229461 48 48 add_action( 'tcp_shopping_cart_widget_units' , array( $this, 'tcp_shopping_cart_widget_units' ), 10, 2 ); 49 49 50 add_filter( 'tcp_cart_units' , array( $this, 'tcp_cart_units' ), 10, 2 ); 50 // Boths hooks for shopping cart lines 51 add_action( 'tcp_cart_units' , array( $this, 'tcp_cart_units' ), 10, 2 ); 52 add_filter( 'tcp_shopping_cart_page_units' , array( $this, 'tcp_shopping_cart_page_units' ), 10, 2 ); 51 53 52 54 add_action( 'tcp_shopping_cart_summary_widget_form' , array( $this, 'tcp_shopping_cart_summary_widget_form' ), 10, 2 ); … … 55 57 add_action( 'tcp_show_shopping_cart_summary_widget_params' , array( $this, 'tcp_show_shopping_cart_summary_widget_params' ) ); 56 58 57 // add_filter( 'tcp_the_add_to_cart_unit_field' , array( $this, 'tcp_the_add_to_cart_unit_field' ), 10, 2 );58 59 // Removes the unit fields if no units enough 60 add_filter( 'tcp_the_add_to_cart_unit_field' , array( $this, 'tcp_the_add_to_cart_unit_field' ), 10, 2 ); 59 61 add_filter( 'tcp_the_add_to_cart_button' , array( $this, 'tcp_the_add_to_cart_button' ), 10, 2 ); 60 62 … … 531 533 } 532 534 535 /** 536 * Adds “out of stock" in the shopping cart lines, if no units enough 537 * 538 * @param $item, each line in the shoppingCart 539 */ 533 540 function tcp_cart_units( $item ) { 534 global $thecartpress;535 $stock_management = $thecartpress->get_setting( 'stock_management', false );536 if ( $stock_management ) {541 //global $thecartpress; 542 //$stock_management = $thecartpress->get_setting( 'stock_management', false ); 543 //if ( $stock_management ) { 537 544 $stock = tcp_get_the_stock( $item->get_post_id(), $item->get_option_1_id(), $item->get_option_2_id() ); 538 545 ob_start(); … … 545 552 <?php endif; 546 553 echo apply_filters( 'tcp_stock_cart_units', ob_get_clean(), $item->get_post_id() ); 547 } 554 //} 555 } 556 557 /** 558 * Allows to change the unit field in the shopping cart 559 * 560 * @param $out 561 * @param $order_detail 562 */ 563 function tcp_shopping_cart_page_units( $out, $order_detail ) { 564 $stock = tcp_get_the_stock( $order_detail->get_post_id() ); 565 //if ( $stock != -1 && $stock == $order_detail->get_qty_ordered() ) { 566 if ( $stock == 1 ) { 567 return $order_detail->get_qty_ordered(); 568 } 569 return $out; 548 570 } 549 571 … … 760 782 } 761 783 784 /** 785 * Removes the unit fields if no units enough, or hides the unit fields if only one unit is available 786 * 787 * @param $out 788 * @param $post_id, product identifier 789 */ 762 790 function tcp_the_add_to_cart_unit_field( $out, $post_id ) { 763 if ( tcp_get_the_stock( $post_id ) == 0 ) return '<span class="tcp_no_stock">' . __( 'Out of stock', 'tcp' ) . '</span>'; 791 $stock = tcp_get_the_stock( $post_id ); 792 if ( $stock == 0 ) { 793 return '<span class="tcp_no_stock">' . __( 'Out of stock', 'tcp' ) . '</span>'; 794 795 // Since 1.4.3, if units in stock are less or equal to shopingcart, it hides the units fields 796 } elseif ( $stock == 1 ) { 797 return '<input type="hidden" name="tcp_count[]" id="tcp_count_' . $post_id . '" value="1" />'; 798 } elseif ( $stock > 1 ) { 799 $shopingcart = thecartpress()->getShoppingCart(); 800 $item = $shopingcart->getItem( $post_id ); 801 if ( $item !== false ) { 802 if ( $stock <= $item->getCount() ) { 803 return '<input type="hidden" name="tcp_count[]" id="tcp_count_' . $post_id . '" value="1" />'; 804 } 805 } 806 } 764 807 return $out; 765 808 } 766 809 767 810 function tcp_the_add_to_cart_button( $out, $post_id ) { 768 if ( tcp_get_the_stock( $post_id ) == 0 ) return '<input type="hidden" name="tcp_post_id[]" id="tcp_post_id_' . $post_id . '" value="' . $post_id . '" />'; 811 $stock = tcp_get_the_stock( $post_id ); 812 if ( $stock == 0 ) { 813 return '<input type="hidden" name="tcp_post_id[]" id="tcp_post_id_' . $post_id . '" value="' . $post_id . '" />'; 814 815 // Since 1.4.3, if units in stock are less or equal to shopingcart, it hides the units fields 816 } else if ( $stock > 0 ) { 817 $shopingcart = thecartpress()->getShoppingCart(); 818 $item = $shopingcart->getItem( $post_id ); 819 if ( $item !== false ) { 820 if ( $stock <= $item->getCount() ) { 821 return '<input type="hidden" name="tcp_post_id[]" id="tcp_post_id_' . $post_id . '" value="' . $post_id . '" />'; 822 } 823 } 824 } 769 825 return $out; 770 826 } -
thecartpress/trunk/readme.txt
r1225478 r1229461 6 6 Requires at least: 3.3 7 7 Tested up to: 4.3 8 Stable Tag: 1.4. 28 Stable Tag: 1.4.3 9 9 Native eCommerce integration & interaction with WordPress. Flexibility & Scalability. 10 10 Ideal for merchants, themes constructors and developers. … … 299 299 300 300 == Changelog == 301 = 1.4.3 = 302 * Checkout, Billing and Shopping steps: fix issue when region id is required and no regions list 303 * Stock manager: When only one unit (or units on stok are added to the shopping cart), hide the buy button and the units field 304 * WP 4.3 support 305 301 306 = 1.4.2 = 302 307 * Internal improvements in searchs -
thecartpress/trunk/templates/tcp_template.php
r1152289 r1229461 1440 1440 $path = apply_filters( 'tcp_the_loop', $path, $loop ); 1441 1441 1442 if ( $include ) include( $path ); 1443 else return $path; 1442 if ( $include ) { 1443 include( $path ); 1444 } else { 1445 return $path; 1446 } 1444 1447 } 1445 1448 … … 1465 1468 */ 1466 1469 function tcp_session_start( $time = 3600, $session_name = 'tcp' ) { 1467 /*if ( session_id() == $session_name ) return;1468 session_set_cookie_params( $time );1469 session_name( $session_name );*/1470 1470 if ( ! session_id() ) session_start(); 1471 /* if ( isset( $_COOKIE[$session_name] ) ) {1472 setcookie( $session_name, $_COOKIE[$session_name], time() + $time, null, null, true );1473 setcookie( $session_name, $_COOKIE[$session_name], time() + $time, null, null, false );1474 }*/1475 1471 } 1476 1472 1477 1473 function tcp_return_jsonp( $params ) { 1478 1479 // exit( $_REQUEST['callback'] . '(' . json_encode( $params ) . ')' );1480 //if ( is_array( $params ) ) $params = array( $params );1481 //var_dump( json_encode( $params ) );1482 1474 exit( json_encode( $params ) ); 1483 1475 } -
thecartpress/trunk/themes-templates/tcp_shopping_cart.php
r1164243 r1229461 226 226 <td class="tcp_cart_thumbnail"> 227 227 <?php //$size = apply_filters( 'tcp_get_shopping_cart_image_size', array( 32, 32 ) ); 228 echo tcp_get_the_thumbnail( $order_detail->get_post_id(), $order_detail->get_option_1_id(), $order_detail->get_option_2_id() ); //, $size );?>228 echo tcp_get_the_thumbnail( $order_detail->get_post_id(), $order_detail->get_option_1_id(), $order_detail->get_option_2_id() ); ?> 229 229 </td> 230 230 <?php endif; ?> -
thecartpress/trunk/widgets/ArchivesWidget.class.php
r979914 r1229461 31 31 'id_base' => 'tcparchives-widget', 32 32 ); 33 $this->WP_Widget( 'tcparchives-widget', 'TCP Archives', $widget, $control );33 parent::__construct( 'tcparchives-widget', 'TCP Archives', $widget, $control ); 34 34 } 35 35 -
thecartpress/trunk/widgets/AttributesListWidget.class.php
r524619 r1229461 28 28 'id_base' => 'attributeslist-widget' 29 29 ); 30 $this->WP_Widget( 'attributeslist-widget', 'TCP Attributes List', $widget_settings, $control_settings );30 parent::__construct( 'attributeslist-widget', 'TCP Attributes List', $widget_settings, $control_settings ); 31 31 } 32 32 -
thecartpress/trunk/widgets/BuyButtonWidget.class.php
r627608 r1229461 27 27 'id_base' => 'buybutton-widget', 28 28 ); 29 $this->WP_Widget( 'buybutton-widget', 'TCP Buy Button', $widget, $control );29 parent::__construct( 'buybutton-widget', 'TCP Buy Button', $widget, $control ); 30 30 } 31 31 -
thecartpress/trunk/widgets/CheckoutWidget.class.php
r462585 r1229461 28 28 'id_base' => 'checkout-widget' 29 29 ); 30 $this->WP_Widget( 'checkout-widget', 'TCP Checkout', $widget_settings, $control_settings );30 parent::__construct( 'checkout-widget', 'TCP Checkout', $widget_settings, $control_settings ); 31 31 } 32 32 -
thecartpress/trunk/widgets/CommentsCustomPostTypeWidget.class.php
r791204 r1229461 33 33 'id_base' => 'commentscustomposttype-widget' 34 34 ); 35 $this->WP_Widget( 'commentscustomposttype-widget', 'TCP Comments for Custom Post Type', $widget_settings, $control_settings );35 parent::__construct( 'commentscustomposttype-widget', 'TCP Comments for Custom Post Type', $widget_settings, $control_settings ); 36 36 //add_action( 'wp_unregister_sidebar_widget', array( $this, 'wpUnregisterSidebarWidget' ) ); 37 37 } -
thecartpress/trunk/widgets/LoginWidget.class.php
r776872 r1229461 33 33 'id_base' => 'tcp_login-widget' 34 34 ); 35 $this->WP_Widget( 'tcp_login-widget', 'TCP Login Form', $widget_settings, $control_settings );35 parent::__construct( 'tcp_login-widget', 'TCP Login Form', $widget_settings, $control_settings ); 36 36 } 37 37 -
thecartpress/trunk/widgets/SelectCountryWidget.class.php
r705474 r1229461 27 27 'id_base' => 'tcpselectcountry-widget', 28 28 ); 29 $this->WP_Widget( 'tcpselectcountry-widget', 'TCP Select Country', $widget, $control );29 parent::__construct( 'tcpselectcountry-widget', 'TCP Select Country', $widget, $control ); 30 30 } 31 31 -
thecartpress/trunk/widgets/ShoppingCartSummaryWidget.class.php
r836081 r1229461 36 36 'id_base' => 'shoppingcartsummary-widget', 37 37 ); 38 $this->WP_Widget( 'shoppingcartsummary-widget', 'TCP Shopping Cart Summary', $widget, $control );38 parent::__construct( 'shoppingcartsummary-widget', 'TCP Shopping Cart Summary', $widget, $control ); 39 39 } 40 40 -
thecartpress/trunk/widgets/ShoppingCartWidget.class.php
r791204 r1229461 33 33 'id_base' => 'shoppingcart-widget', 34 34 ); 35 $this->WP_Widget( 'shoppingcart-widget', 'TCP Shopping Cart', $widget, $control );35 parent::__construct( 'shoppingcart-widget', 'TCP Shopping Cart', $widget, $control ); 36 36 } 37 37 -
thecartpress/trunk/widgets/SortPanelWidget.class.php
r478531 r1229461 28 28 'id_base' => 'sortpanel-widget' 29 29 ); 30 $this->WP_Widget( 'sortpanel-widget', 'TCP Sort Panel', $widget_settings, $control_settings );30 parent::__construct( 'sortpanel-widget', 'TCP Sort Panel', $widget_settings, $control_settings ); 31 31 } 32 32 -
thecartpress/trunk/widgets/TCPParentWidget.class.php
r979914 r1229461 32 32 'id_base' => $name . '-widget' 33 33 ); 34 $this->WP_Widget( $name . '-widget', $title, $widget_settings, $control_settings );34 parent::__construct( $name . '-widget', $title, $widget_settings, $control_settings ); 35 35 } 36 36
Note: See TracChangeset
for help on using the changeset viewer.