From 43c1ff17addab94b7b481e85ee43d8ef07eda796 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 10 Aug 2011 18:11:50 +0100 Subject: [PATCH] More woo goodness --- admin/write-panels/order-data-save.php | 178 ---- admin/write-panels/order-data.php | 438 --------- admin/write-panels/product-data-save.php | 211 ---- admin/write-panels/product-data.php | 364 ------- admin/write-panels/product-type.php | 32 - assets/css/admin.css | 1114 ++++------------------ assets/images/icons/jigoshop-icon.png | Bin 763 -> 0 bytes assets/images/icons/jigoshop-icons.png | Bin 10511 -> 0 bytes jigoshop.php | 633 ------------ jigoshop_actions.php | 632 ------------ jigoshop_cron.php | 52 - jigoshop_emails.php | 260 ----- jigoshop_query.php | 276 ------ jigoshop_shortcodes.php | 187 ---- jigoshop_taxonomy.php | 409 -------- jigoshop_template_actions.php | 79 -- jigoshop_template_functions.php | 793 --------------- jigoshop_templates.php | 110 --- jigoshop_widgets.php | 14 - languages/countries.php | 255 ----- shortcodes/cart.php | 172 ---- shortcodes/checkout.php | 32 - shortcodes/my_account.php | 520 ---------- shortcodes/order_tracking.php | 143 --- shortcodes/pay.php | 145 --- shortcodes/thankyou.php | 56 -- widgets/cart.php | 83 -- widgets/featured_products.php | 103 -- widgets/layered_nav.php | 175 ---- widgets/price_filter.php | 117 --- widgets/product_categories.php | 113 --- widgets/product_search.php | 59 -- widgets/product_tag_cloud.php | 64 -- widgets/recent_products.php | 125 --- 34 files changed, 211 insertions(+), 7733 deletions(-) delete mode 100644 admin/write-panels/order-data-save.php delete mode 100644 admin/write-panels/order-data.php delete mode 100644 admin/write-panels/product-data-save.php delete mode 100644 admin/write-panels/product-data.php delete mode 100644 admin/write-panels/product-type.php delete mode 100644 assets/images/icons/jigoshop-icon.png delete mode 100644 assets/images/icons/jigoshop-icons.png delete mode 100644 jigoshop.php delete mode 100644 jigoshop_actions.php delete mode 100644 jigoshop_cron.php delete mode 100644 jigoshop_emails.php delete mode 100644 jigoshop_query.php delete mode 100644 jigoshop_shortcodes.php delete mode 100644 jigoshop_taxonomy.php delete mode 100644 jigoshop_template_actions.php delete mode 100644 jigoshop_template_functions.php delete mode 100644 jigoshop_templates.php delete mode 100644 jigoshop_widgets.php delete mode 100644 languages/countries.php delete mode 100644 shortcodes/cart.php delete mode 100644 shortcodes/checkout.php delete mode 100644 shortcodes/my_account.php delete mode 100644 shortcodes/order_tracking.php delete mode 100644 shortcodes/pay.php delete mode 100644 shortcodes/thankyou.php delete mode 100644 widgets/cart.php delete mode 100644 widgets/featured_products.php delete mode 100644 widgets/layered_nav.php delete mode 100644 widgets/price_filter.php delete mode 100644 widgets/product_categories.php delete mode 100644 widgets/product_search.php delete mode 100644 widgets/product_tag_cloud.php delete mode 100644 widgets/recent_products.php diff --git a/admin/write-panels/order-data-save.php b/admin/write-panels/order-data-save.php deleted file mode 100644 index cd8434c2013..00000000000 --- a/admin/write-panels/order-data-save.php +++ /dev/null @@ -1,178 +0,0 @@ -update_status( $_POST['order_status'] ); - - // Order items - $order_items = array(); - - if (isset($_POST['item_id'])) : - $item_id = $_POST['item_id']; - $item_variation= $_POST['item_variation']; - $item_name = $_POST['item_name']; - $item_quantity = $_POST['item_quantity']; - $item_cost = $_POST['item_cost']; - $item_tax_rate = $_POST['item_tax_rate']; - - for ($i=0; $i htmlspecialchars(stripslashes($item_id[$i])), - 'variation_id' => (int) $item_variation[$i], - 'name' => htmlspecialchars(stripslashes($item_name[$i])), - 'qty' => (int) $item_quantity[$i], - 'cost' => number_format(jigowatt_clean($item_cost[$i]), 2), - 'taxrate' => number_format(jigowatt_clean($item_tax_rate[$i]), 4) - )); - - endfor; - endif; - - // Save - update_post_meta( $post_id, 'order_data', $data ); - update_post_meta( $post_id, 'order_items', $order_items ); - - - // Handle button actions - - if (isset($_POST['reduce_stock']) && $_POST['reduce_stock'] && sizeof($order_items)>0) : - - $order->add_order_note( __('Manually reducing stock.', 'jigoshop') ); - - foreach ($order_items as $order_item) : - - $_product = $order->get_product_from_item( $order_item ); - - if ($_product->exists) : - - if ($_product->managing_stock()) : - - $old_stock = $_product->stock; - - $new_quantity = $_product->reduce_stock( $order_item['qty'] ); - - $order->add_order_note( sprintf( __('Item #%s stock reduced from %s to %s.', 'jigoshop'), $order_item['id'], $old_stock, $new_quantity) ); - - if ($new_quantity<0) : - do_action('jigoshop_product_on_backorder_notification', $order_item['id'], $values['quantity']); - endif; - - // stock status notifications - if (get_option('jigoshop_notify_no_stock_amount') && get_option('jigoshop_notify_no_stock_amount')>=$new_quantity) : - do_action('jigoshop_no_stock_notification', $order_item['id']); - elseif (get_option('jigoshop_notify_low_stock_amount') && get_option('jigoshop_notify_low_stock_amount')>=$new_quantity) : - do_action('jigoshop_low_stock_notification', $order_item['id']); - endif; - - endif; - - else : - - $order->add_order_note( sprintf( __('Item %s %s not found, skipping.', 'jigoshop'), $order_item['id'], $order_item['name'] ) ); - - endif; - - endforeach; - - $order->add_order_note( __('Manual stock reduction complete.', 'jigoshop') ); - - elseif (isset($_POST['restore_stock']) && $_POST['restore_stock'] && sizeof($order_items)>0) : - - $order->add_order_note( __('Manually restoring stock.', 'jigoshop') ); - - foreach ($order_items as $order_item) : - - $_product = $order->get_product_from_item( $order_item ); - - if ($_product->exists) : - - if ($_product->managing_stock()) : - - $old_stock = $_product->stock; - - $new_quantity = $_product->increase_stock( $order_item['qty'] ); - - $order->add_order_note( sprintf( __('Item #%s stock increased from %s to %s.', 'jigoshop'), $order_item['id'], $old_stock, $new_quantity) ); - - endif; - - else : - - $order->add_order_note( sprintf( __('Item %s %s not found, skipping.', 'jigoshop'), $order_item['id'], $order_item['name'] ) ); - - endif; - - endforeach; - - $order->add_order_note( __('Manual stock restore complete.', 'jigoshop') ); - - elseif (isset($_POST['invoice']) && $_POST['invoice']) : - - // Mail link to customer - jigoshop_pay_for_order_customer_notification( $order->id ); - - endif; - - // Error Handling - if (sizeof($jigoshop_errors)>0) update_option('jigoshop_errors', $jigoshop_errors); -} \ No newline at end of file diff --git a/admin/write-panels/order-data.php b/admin/write-panels/order-data.php deleted file mode 100644 index 86eeeef16b3..00000000000 --- a/admin/write-panels/order-data.php +++ /dev/null @@ -1,438 +0,0 @@ -ID, 'order_data', true) ); - - if (!isset($data['billing_first_name'])) $data['billing_first_name'] = ''; - if (!isset($data['billing_last_name'])) $data['billing_last_name'] = ''; - if (!isset($data['billing_company'])) $data['billing_company'] = ''; - if (!isset($data['billing_address_1'])) $data['billing_address_1'] = ''; - if (!isset($data['billing_address_2'])) $data['billing_address_2'] = ''; - if (!isset($data['billing_city'])) $data['billing_city'] = ''; - if (!isset($data['billing_postcode'])) $data['billing_postcode'] = ''; - if (!isset($data['billing_country'])) $data['billing_country'] = ''; - if (!isset($data['billing_state'])) $data['billing_state'] = ''; - if (!isset($data['billing_email'])) $data['billing_email'] = ''; - if (!isset($data['billing_phone'])) $data['billing_phone'] = ''; - if (!isset($data['shipping_first_name'])) $data['shipping_first_name'] = ''; - if (!isset($data['shipping_last_name'])) $data['shipping_last_name'] = ''; - if (!isset($data['shipping_company'])) $data['shipping_company'] = ''; - if (!isset($data['shipping_address_1'])) $data['shipping_address_1'] = ''; - if (!isset($data['shipping_address_2'])) $data['shipping_address_2'] = ''; - if (!isset($data['shipping_city'])) $data['shipping_city'] = ''; - if (!isset($data['shipping_postcode'])) $data['shipping_postcode'] = ''; - if (!isset($data['shipping_country'])) $data['shipping_country'] = ''; - if (!isset($data['shipping_state'])) $data['shipping_state'] = ''; - - $data['customer_user'] = (int) get_post_meta($post->ID, 'customer_user', true); - - $order_status = wp_get_post_terms($post->ID, 'shop_order_status'); - if ($order_status) : - $order_status = current($order_status); - $data['order_status'] = $order_status->slug; - else : - $data['order_status'] = 'pending'; - endif; - - if (!isset($post->post_title) || empty($post->post_title)) : - $order_title = 'Order'; - else : - $order_title = $post->post_title; - endif; - - ?> - -
- - - - - -
- -

-

- -

-

- -

-

-
- -
'billing_first_name', 'label' => 'First Name:' ); - echo '

-

'; - - // Last Name - $field = array( 'id' => 'billing_last_name', 'label' => 'Last Name:' ); - echo '

-

'; - - // Company - $field = array( 'id' => 'billing_company', 'label' => 'Company:' ); - echo '

-

'; - - // Address 1 - $field = array( 'id' => 'billing_address_1', 'label' => 'Address 1:' ); - echo '

-

'; - - // Address 2 - $field = array( 'id' => 'billing_address_2', 'label' => 'Address 2:' ); - echo '

-

'; - - // City - $field = array( 'id' => 'billing_city', 'label' => 'City:' ); - echo '

-

'; - - // Postcode - $field = array( 'id' => 'billing_postcode', 'label' => 'Postcode:' ); - echo '

-

'; - - // Country - $field = array( 'id' => 'billing_country', 'label' => 'Country:' ); - echo '

-

'; - - // State - $field = array( 'id' => 'billing_state', 'label' => 'State/County:' ); - echo '

-

'; - - // Email - $field = array( 'id' => 'billing_email', 'label' => 'Email Address:' ); - echo '

-

'; - - // Tel - $field = array( 'id' => 'billing_phone', 'label' => 'Tel:' ); - echo '

-

'; - - ?> -
- -
- -

- 'shipping_first_name', 'label' => 'First Name:' ); - echo '

-

'; - - // Last Name - $field = array( 'id' => 'shipping_last_name', 'label' => 'Last Name:' ); - echo '

-

'; - - // Company - $field = array( 'id' => 'shipping_company', 'label' => 'Company:' ); - echo '

-

'; - - // Address 1 - $field = array( 'id' => 'shipping_address_1', 'label' => 'Address 1:' ); - echo '

-

'; - - // Address 2 - $field = array( 'id' => 'shipping_address_2', 'label' => 'Address 2:' ); - echo '

-

'; - - // City - $field = array( 'id' => 'shipping_city', 'label' => 'City:' ); - echo '

-

'; - - // Postcode - $field = array( 'id' => 'shipping_postcode', 'label' => 'Postcode:' ); - echo '

-

'; - - // Country - $field = array( 'id' => 'shipping_country', 'label' => 'Country:' ); - echo '

-

'; - - // State - $field = array( 'id' => 'shipping_state', 'label' => 'State/County:' ); - echo '

-

'; - - ?> -
-
- ID, 'order_items', true) ); - ?> -
- - - - - - - - - - - - - - - - - - - 0 && isset($order_items[0]['id'])) foreach ($order_items as $item) : - - if (isset($item['variation_id']) && $item['variation_id'] > 0) : - $_product = &new jigoshop_product_variation( $item['variation_id'] ); - else : - $_product = &new jigoshop_product( $item['id'] ); - endif; - - ?> - - - - - - - - - - - - - - - -
sku) echo $_product->sku; ?>variation_data)) : - echo jigoshop_get_formatted_variation( $_product->variation_data, true ); - else : - echo '-'; - endif; - ?> - - - - - - - -
-
- - - -
-
-

- - - -

-

- -

- -
- - - ID, 'order_data', true) ); - - if (!isset($data['shipping_method'])) $data['shipping_method'] = ''; - if (!isset($data['payment_method'])) $data['payment_method'] = ''; - if (!isset($data['order_subtotal'])) $data['order_subtotal'] = ''; - if (!isset($data['order_shipping'])) $data['order_shipping'] = ''; - if (!isset($data['order_discount'])) $data['order_discount'] = ''; - if (!isset($data['order_tax'])) $data['order_tax'] = ''; - if (!isset($data['order_total'])) $data['order_total'] = ''; - if (!isset($data['order_shipping_tax'])) $data['order_shipping_tax'] = ''; - ?> -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- htmlspecialchars(stripslashes($attribute_names[$i])), - 'value' => $attribute_values[$i], - 'position' => $attribute_position[$i], - 'visible' => $visible, - 'variation' => $variation, - 'is_taxonomy' => $is_taxonomy - ); - - if ($is_taxonomy=='yes') : - // Update post terms - $tax = $attribute_names[$i]; - $value = $attribute_values[$i]; - - if (taxonomy_exists('product_attribute_'.strtolower(sanitize_title($tax)))) : - - wp_set_object_terms( $post_id, $value, 'product_attribute_'.strtolower(sanitize_title($tax)) ); - - endif; - - endif; - - endfor; - endif; - - if (!function_exists('attributes_cmp')) { - function attributes_cmp($a, $b) { - if ($a['position'] == $b['position']) { - return 0; - } - return ($a['position'] < $b['position']) ? -1 : 1; - } - } - uasort($attributes, 'attributes_cmp'); - - // Product type - $product_type = sanitize_title( stripslashes( $_POST['product-type'] ) ); - if( !$product_type ) $product_type = 'simple'; - - wp_set_object_terms($post_id, $product_type, 'product_type'); - - // visibility - $visibility = stripslashes( $_POST['visibility'] ); - update_post_meta( $post_id, 'visibility', $visibility ); - - // Featured - $featured = stripslashes( $_POST['featured'] ); - update_post_meta( $post_id, 'featured', $featured ); - - // Unique SKU - $SKU = get_post_meta($post_id, 'SKU', true); - $new_sku = stripslashes( $_POST['sku'] ); - if ($new_sku!==$SKU) : - if ($new_sku && !empty($new_sku)) : - if ($wpdb->get_var("SELECT * FROM $wpdb->postmeta WHERE meta_key='SKU' AND meta_value='".$new_sku."';") || $wpdb->get_var("SELECT * FROM $wpdb->posts WHERE ID='".$new_sku."' AND ID!=".$post_id.";")) : - $jigoshop_errors[] = __('Product SKU must be unique.', 'jigoshop'); - else : - update_post_meta( $post_id, 'SKU', $new_sku ); - endif; - else : - update_post_meta( $post_id, 'SKU', '' ); - endif; - endif; - - // Sales and prices - - if ($product_type!=='grouped') : - - $date_from = (isset($_POST['sale_price_dates_from'])) ? $_POST['sale_price_dates_from'] : ''; - $date_to = (isset($_POST['sale_price_dates_to'])) ? $_POST['sale_price_dates_to'] : ''; - - // Dates - if ($date_from) : - update_post_meta( $post_id, 'sale_price_dates_from', strtotime($date_from) ); - else : - update_post_meta( $post_id, 'sale_price_dates_from', '' ); - endif; - - if ($date_to) : - update_post_meta( $post_id, 'sale_price_dates_to', strtotime($date_to) ); - else : - update_post_meta( $post_id, 'sale_price_dates_to', '' ); - endif; - - if ($date_to && !$date_from) : - update_post_meta( $post_id, 'sale_price_dates_from', strtotime('NOW') ); - endif; - - // Update price if on sale - if ($data['sale_price'] && $date_to == '' && $date_from == '') : - update_post_meta( $post_id, 'price', $data['sale_price'] ); - else : - update_post_meta( $post_id, 'price', $data['regular_price'] ); - endif; - - if ($date_from && strtotime($date_from) < strtotime('NOW')) : - update_post_meta( $post_id, 'price', $data['sale_price'] ); - endif; - - if ($date_to && strtotime($date_to) < strtotime('NOW')) : - update_post_meta( $post_id, 'price', $data['regular_price'] ); - update_post_meta( $post_id, 'sale_price_dates_from', ''); - update_post_meta( $post_id, 'sale_price_dates_to', ''); - endif; - - else : - - $data['sale_price'] = ''; - $data['regular_price'] = ''; - update_post_meta( $post_id, 'sale_price_dates_from', '' ); - update_post_meta( $post_id, 'sale_price_dates_to', '' ); - update_post_meta( $post_id, 'price', '' ); - - endif; - - // Stock Data - - if (get_option('jigoshop_manage_stock')=='yes') : - // Manage Stock Checkbox - if ($product_type!=='grouped' && isset($_POST['manage_stock']) && $_POST['manage_stock']) : - - update_post_meta( $post_id, 'stock', $_POST['stock'] ); - $data['manage_stock'] = 'yes'; - $data['backorders'] = stripslashes( $_POST['backorders'] ); - - else : - - update_post_meta( $post_id, 'stock', '0' ); - $data['manage_stock'] = 'no'; - $data['backorders'] = 'no'; - - endif; - endif; - - // Apply filters to data - $data = apply_filters( 'process_product_meta', $data, $post_id ); - - // Apply filter to data for product type - $data = apply_filters( 'filter_product_meta_' . $product_type, $data, $post_id ); - - // Do action for product type - do_action( 'process_product_meta_' . $product_type, $data, $post_id ); - - // Save - update_post_meta( $post_id, 'product_attributes', $attributes ); - update_post_meta( $post_id, 'product_data', $data ); - update_option('jigoshop_errors', $jigoshop_errors); -} \ No newline at end of file diff --git a/admin/write-panels/product-data.php b/admin/write-panels/product-data.php deleted file mode 100644 index d5e4429cb30..00000000000 --- a/admin/write-panels/product-data.php +++ /dev/null @@ -1,364 +0,0 @@ -ID, 'product_data', true) ); - $featured = (string) get_post_meta( $post->ID, 'featured', true ); - $visibility = (string) get_post_meta( $post->ID, 'visibility', true); - - if (!isset($data['weight'])) $data['weight'] = ''; - if (!isset($data['regular_price'])) $data['regular_price'] = ''; - if (!isset($data['sale_price'])) $data['sale_price'] = ''; - - $thepostid = $post->ID; - - ?> -
- - -
slug; else $product_type = 'simple'; - $field = array( 'id' => 'product-type', 'label' => __('Product Type', 'jigoshop') ); - echo '

'; - - // List Grouped products - $posts_in = (array) get_objects_in_term( get_term_by( 'slug', 'grouped', 'product_type' )->term_id, 'product_type' ); - $posts_in = array_unique($posts_in); - - $field = array( 'id' => 'parent_id', 'label' => __('Parent post', 'jigoshop') ); - echo '

'; - - // Ordering - $menu_order = $post->menu_order; - $field = array( 'id' => 'menu_order', 'label' => _x('Post Order', 'ordering', 'jigoshop') ); - echo ''; - - - // Summary - echo '

-

'; - - // SKU - $field = array( 'id' => 'sku', 'label' => __('SKU', 'jigoshop') ); - $SKU = get_post_meta($thepostid, 'SKU', true); - - if( get_option('jigoshop_enable_sku', true) !== 'no' ) : - echo '

- - ' . __('Leave blank to use product ID', 'jigoshop') . '

'; - else: - echo ''; - endif; - - // Weight - $field = array( 'id' => 'weight', 'label' => __('Weight', 'jigoshop') . ' ('.get_option('jigoshop_weight_unit').'):' ); - - if( get_option('jigoshop_enable_weight', true) !== 'no' ) : - echo '

- -

'; - else: - echo ''; - endif; - - // Featured - $field = array( 'id' => 'featured', 'label' => __('Featured?', 'jigoshop') ); - echo '

'; - - // Visibility - $field = array( 'id' => 'visibility', 'label' => __('Visibility', 'jigoshop') ); - echo '

'; - ?> -
-
- - 'regular_price', 'label' => __('Regular Price', 'jigoshop') . ' ('.get_jigoshop_currency_symbol().'):' ); - echo '

- -

'; - - // Special Price - $field = array( 'id' => 'sale_price', 'label' => __('Sale Price', 'jigoshop') . ' ('.get_jigoshop_currency_symbol().'):' ); - echo '

- -

'; - - // Special Price date range - $field = array( 'id' => 'sale_price_dates', 'label' => __('Sale Price Dates', 'jigoshop') ); - - $sale_price_dates_from = get_post_meta($thepostid, 'sale_price_dates_from', true); - $sale_price_dates_to = get_post_meta($thepostid, 'sale_price_dates_to', true); - - echo '

- - - - ' . __('Date format', 'jigoshop') . ': YYYY-MM-DD -

'; - - // Tax - $_tax = new jigoshop_tax(); - - $field = array( 'id' => 'tax_status', 'label' => __('Tax Status', 'jigoshop') ); - echo '

'; - - $field = array( 'id' => 'tax_class', 'label' => __('Tax Class', 'jigoshop') ); - echo '

'; - ?> - -
- -
- - 'manage_stock', 'label' => __('Manage stock?', 'jigoshop') ); - echo '

'; - - // Stock status - $field = array( 'id' => 'stock_status', 'label' => 'Stock status:' ); - echo '

'; - - echo '
'; - - // Stock - $field = array( 'id' => 'stock', 'label' => __('Stock Qty', 'jigoshop') ); - echo '

- - -

'; - - // Backorders? - $field = array( 'id' => 'backorders', 'label' => __('Allow Backorders?', 'jigoshop') ); - echo '

'; - - echo '
'; - ?> - -
- -
- -
- - - - - - - - - - - - - ID, 'product_attributes', true) ); - - $i = -1; - - // Taxonomies - if ( $attribute_taxonomies ) : - foreach ($attribute_taxonomies as $tax) : $i++; - - $attribute_nicename = strtolower(sanitize_title($tax->attribute_name)); - if (isset($attributes[$attribute_nicename])) $attribute = $attributes[$attribute_nicename]; - if (isset($attribute['visible']) && $attribute['visible']=='yes') $checked = 'checked="checked"'; else $checked = ''; - if (isset($attribute['variation']) && $attribute['variation']=='yes') $checked2 = 'checked="checked"'; else $checked2 = ''; - - $values = wp_get_post_terms( $thepostid, 'product_attribute_'.strtolower(sanitize_title($tax->attribute_name)) ); - $value = array(); - if (!is_wp_error($values) && $values) : - foreach ($values as $v) : - $value[] = $v->slug; - endforeach; - endif; - - ?>> - - - - - - - 0) foreach ($attributes as $attribute) : - if (isset($attribute['is_taxonomy']) && $attribute['is_taxonomy']=='yes') continue; - - $i++; - - if (isset($attribute['visible']) && $attribute['visible']=='yes') $checked = 'checked="checked"'; else $checked = ''; - if (isset($attribute['variation']) && $attribute['variation']=='yes') $checked2 = 'checked="checked"'; else $checked2 = ''; - - ?> - - - - - - - - -
- - - - attribute_name; ?> - - - - attribute_type=="select" || $tax->attribute_type=="multiselect") : ?> - - attribute_type=="text") : ?> - - - name="attribute_visibility[]" value="1" /> name="attribute_variation[]" value="1" />
- - - - - - name="attribute_visibility[]" value="1" /> name="attribute_variation[]" value="1" />
-
- - -
-
- - - -
- -
- -
- Llgmq#VHAg-_q#YZNAnxUvaB@2E+9msRMZ$j zZ6gAqO^ayJe^9h3Y|;M^E?Zhr`%r9Z5!nSIGsbERi_}tQocsHI?`h!$!l*@Obr$D5 z=l45@1AvGOiO9H!82NXYwb~&7M?{7uXCL2q`Ei8Y!UQ6QzlBnk>P+?xq`C(OLc(&^hYs&Bqi;t5($1cuJ?ae9DJ=f4diD%hcEEJ~L-f{vR6sQ&_iMk=QU&FTT4Zwy1B@k<9r6tx) zRp-eqj1mMDy!b(m?i=F3&dYcakEXB#sLcS^i7@js!-I(nXn%$C{rBkf2FQN9&+`wr z*_}MY=|jV`#yfCrf3t;ENR*}W3}f%F(vdiVYr-^zcaVth#~4k%oFg!G8eL~Iz_KiC z3z{PyuHDMiYzF)|=lXBb-g=66xnZ(%4^dVKuW{dIfbaWgKcHUsDVD1gN^wMl>F=XV z&pl#(`5lpl7L*-YJK%2s#ZsZn*M((_G1LQtZGm8TmCMl6zKcZTUbNKEriMZ`7U=+) zuD1U4O64belE*ci t&y)jRe_GS3EIN~Yq`C(I#(@8O=U)=Xfszko$K?P3002ovPDHLkV1j^lRCWLW diff --git a/assets/images/icons/jigoshop-icons.png b/assets/images/icons/jigoshop-icons.png deleted file mode 100644 index 2dc60f1db6256e3073f81475bfdb5834ee1edee3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10511 zcmajFbyOV96E2K9L4&(%aLwZGny^@KcMFTVJ1h`vaR?gREy&`o!8HU3PH_45{oV83 zfA5^rGdqiurbIm;Nak}l@w*Q;o#tBV0lh76xf}LNz?=OK=P1Q z(nW(^{%Drbuy=Gh8Q2YGZ!6&t1J_*B3wKiA19k;Q7GehS!x)E81f10N?^+YO-jZeA$EQlP%JtbB~H$?Zpl0X-hpNKQ>@#2%(g9S!c>)3I3^!xht0)|;kM?@6v9L;+g z4ryQ=5j+1`Ze(Q)i~OgiX6EGP;^?K7B!A%i%cjHPwe*9*?AUl<&s^Ozbw zW&eMd9$g?`3!08P5-Mrsi+~7Cn)FV4T6m--GLBHJ)UFgPIlMwIM|*!tEyKM`+$NF} z4#YYZ%+E>y4O4R!LefWNKRBYqosR$eeOXr&LJ$kB0!4UjbTBjCSP>uud=|^;Y~Y9| z8Q(uJ&4Mz(R@kCQdyJ%Tfm9rW4N?Sxf!$~iH>d~r@<1%8Ju^$6K^T5U zH8V>jip55gk#a~qkp^2fFLHJlg0d1)Ml=SLtVv*S371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dqMbVFype(KRk;BF8}2{08CM|0jBs9$f~J^vKeV8y_9T%~0kX8p=gTncKVr~1 z1o3lJ>UoO)@uUi4(RqaakL{Lq<^S`Fa0xQ-Y4`uI@OI@wV>YXp{zu;{0ZGyQzleIz aLG!QomW>>qiZD_loRXZnY^}6u=>G?WTX0VR diff --git a/jigoshop.php b/jigoshop.php deleted file mode 100644 index c5025ff4990..00000000000 --- a/jigoshop.php +++ /dev/null @@ -1,633 +0,0 @@ -parse( $file ); - - if (isset($import_data['posts'])) : - $posts = $import_data['posts']; - - if ($posts && sizeof($posts)>0) foreach ($posts as $post) : - - if ($post['post_type']=='product') : - - if ($post['terms'] && sizeof($post['terms'])>0) : - - foreach ($post['terms'] as $term) : - - $domain = $term['domain']; - - if (strstr($domain, 'product_attribute_')) : - - // Make sure it exists! - if (!taxonomy_exists( $domain )) : - - $nicename = ucfirst(str_replace('product_attribute_', '', $domain)); - - // Create the taxonomy - $wpdb->insert( $wpdb->prefix . "jigoshop_attribute_taxonomies", array( 'attribute_name' => $nicename, 'attribute_type' => 'text' ), array( '%s', '%s' ) ); - - // Register the taxonomy now so that the import works! - register_taxonomy( $domain, - array('product'), - array( - 'hierarchical' => true, - 'labels' => array( - 'name' => $nicename, - 'singular_name' => $nicename, - 'search_items' => __( 'Search ', 'jigoshop') . $nicename, - 'all_items' => __( 'All ', 'jigoshop') . $nicename, - 'parent_item' => __( 'Parent ', 'jigoshop') . $nicename, - 'parent_item_colon' => __( 'Parent ', 'jigoshop') . $nicename . ':', - 'edit_item' => __( 'Edit ', 'jigoshop') . $nicename, - 'update_item' => __( 'Update ', 'jigoshop') . $nicename, - 'add_new_item' => __( 'Add New ', 'jigoshop') . $nicename, - 'new_item_name' => __( 'New ', 'jigoshop') . $nicename - ), - 'show_ui' => false, - 'query_var' => true, - 'rewrite' => array( 'slug' => strtolower(sanitize_title($nicename)), 'with_front' => false, 'hierarchical' => true ), - ) - ); - - update_option('jigowatt_update_rewrite_rules', '1'); - - endif; - - endif; - - endforeach; - - endif; - - endif; - - endforeach; - - endif; - -} - -add_action('import_start', 'jigoshop_import_start'); - - - -### Functions ######################################################### - -function jigoshop_init() { - - jigoshop_post_type(); - - // Image sizes - add_image_size( 'shop_tiny', jigoshop::get_var('shop_tiny_w'), jigoshop::get_var('shop_tiny_h'), 'true' ); - add_image_size( 'shop_thumbnail', jigoshop::get_var('shop_thumbnail_w'), jigoshop::get_var('shop_thumbnail_h'), 'true' ); - add_image_size( 'shop_small', jigoshop::get_var('shop_small_w'), jigoshop::get_var('shop_small_h'), 'true' ); - add_image_size( 'shop_large', jigoshop::get_var('shop_large_w'), jigoshop::get_var('shop_large_h'), 'true' ); - - // Include template functions here so they are pluggable by themes - include_once( 'jigoshop_template_functions.php' ); - - @ob_start(); - - add_role('customer', 'Customer', array( - 'read' => true, - 'edit_posts' => false, - 'delete_posts' => false - )); - - $css = file_exists(get_stylesheet_directory() . '/jigoshop/style.css') ? get_stylesheet_directory_uri() . '/jigoshop/style.css' : jigoshop::plugin_url() . '/assets/css/frontend.css'; - if (JIGOSHOP_USE_CSS) wp_register_style('jigoshop_frontend_styles', $css ); - - if (is_admin()) : - wp_register_style('jigoshop_admin_styles', jigoshop::plugin_url() . '/assets/css/admin.css'); - wp_register_style('jigoshop_admin_datepicker_styles', jigoshop::plugin_url() . '/assets/css/datepicker.css'); - wp_enqueue_style('jigoshop_admin_styles'); - wp_enqueue_style('jigoshop_admin_datepicker_styles'); - else : - wp_register_style( 'jigoshop_fancybox_styles', jigoshop::plugin_url() . '/assets/css/fancybox.css' ); - wp_register_style( 'jqueryui_styles', jigoshop::plugin_url() . '/assets/css/ui.css' ); - - wp_enqueue_style('jigoshop_frontend_styles'); - wp_enqueue_style('jigoshop_fancybox_styles'); - wp_enqueue_style('jqueryui_styles'); - endif; -} - -function jigoshop_admin_scripts() { - - wp_register_script( 'jigoshop_backend', jigoshop::plugin_url() . '/assets/js/jigoshop_backend.js', 'jquery', '1.0' ); - wp_enqueue_script('jigoshop_backend'); - -} -add_action('admin_print_scripts', 'jigoshop_admin_scripts'); - -function jigoshop_frontend_scripts() { - - wp_register_script( 'jigoshop_frontend', jigoshop::plugin_url() . '/assets/js/jigoshop_frontend.js', 'jquery', '1.0' ); - wp_register_script( 'jigoshop_script', jigoshop::plugin_url() . '/assets/js/script.js', 'jquery', '1.0' ); - wp_register_script( 'fancybox', jigoshop::plugin_url() . '/assets/js/jquery.fancybox-1.3.4.pack.js', 'jquery', '1.0' ); - wp_register_script( 'jqueryui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js', 'jquery', '1.0' ); - - wp_enqueue_script('jquery'); - wp_enqueue_script('jqueryui'); - wp_enqueue_script('jigoshop_frontend'); - wp_enqueue_script('fancybox'); - wp_enqueue_script('jigoshop_script'); - - /* Script.js variables */ - $params = array( - 'currency_symbol' => get_jigoshop_currency_symbol(), - 'countries' => json_encode(jigoshop_countries::$states), - 'select_state_text' => __('Select a state…', 'jigoshop'), - 'state_text' => __('state', 'jigoshop'), - 'variation_not_available_text' => __('This variation is not available.', 'jigoshop'), - 'plugin_url' => jigoshop::plugin_url(), - 'ajax_url' => admin_url('admin-ajax.php'), - 'get_variation_nonce' => wp_create_nonce("get-variation"), - 'review_order_url' => jigoshop_get_template_file_url('checkout/review_order.php', true), - 'option_guest_checkout' => get_option('jigoshop_enable_guest_checkout'), - 'checkout_url' => admin_url('admin-ajax.php?action=jigoshop-checkout') - ); - - if (isset($_SESSION['min_price'])) : - $params['min_price'] = $_SESSION['min_price']; - endif; - if (isset($_SESSION['max_price'])) : - $params['max_price'] = $_SESSION['max_price']; - endif; - - if ( is_page(get_option('jigoshop_checkout_page_id')) || is_page(get_option('jigoshop_pay_page_id')) ) : - $params['is_checkout'] = 1; - else : - $params['is_checkout'] = 0; - endif; - - wp_localize_script( 'jigoshop_script', 'params', $params ); - -} -add_action('template_redirect', 'jigoshop_frontend_scripts'); - - -/* - jigoshop_demo_store - Adds a demo store banner to the site -*/ -function jigoshop_demo_store() { - - if (get_option('jigoshop_demo_store')=='yes') : - - echo '

'.__('This is a demo store for testing purposes — no orders shall be fulfilled.', 'jigoshop').'

'; - - endif; -} - -/* - jigoshop_sharethis - Adds social sharing code to footer -*/ -function jigoshop_sharethis() { - if (is_single() && get_option('jigoshop_sharethis')) : - - if (is_ssl()) : - $sharethis = 'https://ws.sharethis.com/button/buttons.js'; - else : - $sharethis = 'http://w.sharethis.com/button/buttons.js'; - endif; - - echo ''; - - endif; -} - -function is_cart() { - if (is_page(get_option('jigoshop_cart_page_id'))) return true; - return false; -} - -function is_checkout() { - if ( - is_page(get_option('jigoshop_checkout_page_id')) - ) return true; - return false; -} - -if (!function_exists('is_ajax')) { - function is_ajax() { - if ( isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) return true; - return false; - } -} - -function jigoshop_force_ssl() { - if (is_checkout() && !is_ssl()) : - wp_redirect( str_replace('http:', 'https:', get_permalink(get_option('jigoshop_checkout_page_id'))), 301 ); - exit; - endif; -} - -function jigoshop_force_ssl_images( $content ) { - if (is_ssl()) : - if (is_array($content)) : - $content = array_map('jigoshop_force_ssl_images', $content); - else : - $content = str_replace('http:', 'https:', $content); - endif; - endif; - return $content; -} -add_filter('post_thumbnail_html', 'jigoshop_force_ssl_images'); -add_filter('widget_text', 'jigoshop_force_ssl_images'); -add_filter('wp_get_attachment_url', 'jigoshop_force_ssl_images'); -add_filter('wp_get_attachment_image_attributes', 'jigoshop_force_ssl_images'); -add_filter('wp_get_attachment_url', 'jigoshop_force_ssl_images'); - -function get_jigoshop_currency_symbol() { - $currency = get_option('jigoshop_currency'); - $currency_symbol = ''; - switch ($currency) : - case 'AUD' : - case 'BRL' : - case 'CAD' : - case 'MXN' : - case 'NZD' : - case 'HKD' : - case 'SGD' : - case 'USD' : $currency_symbol = '$'; break; - case 'EUR' : $currency_symbol = '€'; break; - case 'JPY' : $currency_symbol = '¥'; break; - - case 'CZK' : - case 'DKK' : - case 'HUF' : - case 'ILS' : - case 'MYR' : - case 'NOK' : - case 'PHP' : - case 'PLN' : - case 'SEK' : - case 'CHF' : - case 'TWD' : - case 'THB' : $currency_symbol = $currency; break; - - case 'GBP' : - default : $currency_symbol = '£'; break; - endswitch; - return apply_filters('jigoshop_currency_symbol', $currency_symbol, $currency); -} - -function jigoshop_price( $price, $args = array() ) { - - extract(shortcode_atts(array( - 'ex_tax_label' => '0' - ), $args)); - - $return = ''; - $num_decimals = (int) get_option('jigoshop_price_num_decimals'); - $currency_pos = get_option('jigoshop_currency_pos'); - $currency_symbol = get_jigoshop_currency_symbol(); - $price = number_format( (double) $price, $num_decimals, get_option('jigoshop_price_decimal_sep'), get_option('jigoshop_price_thousand_sep') ); - - switch ($currency_pos) : - case 'left' : - $return = $currency_symbol . $price; - break; - case 'right' : - $return = $price . $currency_symbol; - break; - case 'left_space' : - $return = $currency_symbol . ' ' . $price; - break; - case 'right_space' : - $return = $price . ' ' . $currency_symbol; - break; - endswitch; - - if ($ex_tax_label && get_option('jigoshop_calc_taxes')=='yes') $return .= __(' (ex. tax)', 'jigoshop'); - - return $return; -} - -/** Show variation info if set */ -function jigoshop_get_formatted_variation( $variation = '', $flat = false ) { - if ($variation && is_array($variation)) : - - $return = ''; - - if (!$flat) : - $return = '
'; - endif; - - $varation_list = array(); - - foreach ($variation as $name => $value) : - - if ($flat) : - $varation_list[] = ucfirst(str_replace('tax_', '', $name)).': '.ucfirst($value); - else : - $varation_list[] = '
'.ucfirst(str_replace('tax_', '', $name)).':
'.ucfirst($value).'
'; - endif; - - endforeach; - - if ($flat) : - $return .= implode(', ', $varation_list); - else : - $return .= implode('', $varation_list); - endif; - - if (!$flat) : - $return .= '
'; - endif; - - return $return; - - endif; -} - -function jigoshop_let_to_num($v) { - $l = substr($v, -1); - $ret = substr($v, 0, -1); - switch(strtoupper($l)){ - case 'P': - $ret *= 1024; - case 'T': - $ret *= 1024; - case 'G': - $ret *= 1024; - case 'M': - $ret *= 1024; - case 'K': - $ret *= 1024; - break; - } - return $ret; -} - -function jigowatt_clean( $var ) { - return strip_tags(stripslashes(trim($var))); -} - -global $jigoshop_body_classes; - -function jigoshop_page_body_classes() { - - global $jigoshop_body_classes; - - $jigoshop_body_classes = (array) $jigoshop_body_classes; - - if (is_checkout() || is_page(get_option('jigoshop_pay_page_id'))) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-checkout' ) ); - - if (is_cart()) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-cart' ) ); - - if (is_page(get_option('jigoshop_thanks_page_id'))) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-thanks' ) ); - - if (is_page(get_option('jigoshop_shop_page_id'))) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-shop' ) ); - - if (is_page(get_option('jigoshop_myaccount_page_id')) || is_page(get_option('jigoshop_edit_address_page_id')) || is_page(get_option('jigoshop_view_order_page_id')) || is_page(get_option('jigoshop_change_password_page_id'))) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-myaccount' ) ); - -} -add_action('wp_head', 'jigoshop_page_body_classes'); - -function jigoshop_add_body_class( $class = array() ) { - - global $jigoshop_body_classes; - - $jigoshop_body_classes = (array) $jigoshop_body_classes; - - $jigoshop_body_classes = array_merge($class, $jigoshop_body_classes); - -} - -function jigoshop_body_class($classes) { - - global $jigoshop_body_classes; - - $jigoshop_body_classes = (array) $jigoshop_body_classes; - - $classes = array_merge($classes, $jigoshop_body_classes); - - return $classes; -} -add_filter('body_class','jigoshop_body_class'); - -### Extra Review Field in comments ######################################################### - -function jigoshop_add_comment_rating($comment_id) { - if ( isset($_POST['rating']) ) : - if (!$_POST['rating'] || $_POST['rating'] > 5 || $_POST['rating'] < 0) $_POST['rating'] = 5; - add_comment_meta( $comment_id, 'rating', $_POST['rating'], true ); - endif; -} -add_action( 'comment_post', 'jigoshop_add_comment_rating', 1 ); - -function jigoshop_check_comment_rating($comment_data) { - // If posting a comment (not trackback etc) and not logged in - if ( isset($_POST['rating']) && !jigoshop::verify_nonce('comment_rating') ) - wp_die( __('You have taken too long. Please go back and refresh the page.', 'jigoshop') ); - - elseif ( isset($_POST['rating']) && empty($_POST['rating']) && $comment_data['comment_type']== '' ) { - wp_die( __('Please rate the product.',"jigowatt") ); - exit; - } - return $comment_data; -} -add_filter('preprocess_comment', 'jigoshop_check_comment_rating', 0); - -### Comments ######################################################### - -function jigoshop_comments($comment, $args, $depth) { - $GLOBALS['comment'] = $comment; global $post; ?> - -
  • id="li-comment-"> -
    - - - -
    -
    - comment_ID, 'rating', true ); ?> -
    - comment_approved == '0') : ?> -

    - -

    - : -

    - -
    -
    -
    -
    -
    - posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID - "; - - if ($clauses['where']) $clauses['where'] .= ' AND '; - - $clauses['where'] .= " - $wpdb->posts.post_type NOT IN ('shop_order') - "; - - return $clauses; - -} -if (!is_admin()) add_filter('comments_clauses', 'jigoshop_exclude_order_comments'); - - - diff --git a/jigoshop_actions.php b/jigoshop_actions.php deleted file mode 100644 index cf767eba66a..00000000000 --- a/jigoshop_actions.php +++ /dev/null @@ -1,632 +0,0 @@ -get_availability(); - - if ($availability['availability']) : - $availability_html = '

    '. $availability['availability'].'

    '; - else : - $availability_html = ''; - endif; - - if (has_post_thumbnail($variation_id)) : - $attachment_id = get_post_thumbnail_id( $variation_id ); - $large_thumbnail_size = apply_filters('single_product_large_thumbnail_size', 'shop_large'); - $image = current(wp_get_attachment_image_src( $attachment_id, $large_thumbnail_size)); - $image_link = current(wp_get_attachment_image_src( $attachment_id, 'full')); - else : - $image = ''; - $image_link = ''; - endif; - - $data = array( - 'price_html' => ''.$_product->get_price_html().'', - 'availability_html' => $availability_html, - 'image_src' => $image, - 'image_link' => $image_link - ); - - echo json_encode( $data ); - - // Quit out - die(); -} - -/** - * Add order item - * - * Add order item via ajax - * - * @since 1.0 - */ -add_action('wp_ajax_jigoshop_add_order_item', 'jigoshop_add_order_item'); - -function jigoshop_add_order_item() { - - check_ajax_referer( 'add-order-item', 'security' ); - - global $wpdb; - - $item_to_add = trim(stripslashes($_POST['item_to_add'])); - - $post = ''; - - // Find the item - if (is_numeric($item_to_add)) : - $post = get_post( $item_to_add ); - endif; - - if (!$post || ($post->post_type!=='product' && $post->post_type!=='product_variation')) : - $post_id = $wpdb->get_var($wpdb->prepare(" - SELECT post_id - FROM $wpdb->posts - LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) - WHERE $wpdb->postmeta.meta_key = 'SKU' - AND $wpdb->posts.post_status = 'publish' - AND $wpdb->posts.post_type = 'shop_product' - AND $wpdb->postmeta.meta_value = '".$item_to_add."' - LIMIT 1 - ")); - $post = get_post( $post_id ); - endif; - - if (!$post || ($post->post_type!=='product' && $post->post_type!=='product_variation')) : - die(); - endif; - - if ($post->post_type=="product") : - $_product = &new jigoshop_product( $post->ID ); - else : - $_product = &new jigoshop_product_variation( $post->ID ); - endif; - - $loop = 0; - ?> - - #id; ?> - variation_id)) echo $_product->variation_id; else echo '-'; ?> - sku) echo $_product->sku; ?> - get_title(); ?> - variation_data)) : - echo jigoshop_get_formatted_variation( $_product->variation_data, true ); - else : - echo '-'; - endif; - ?> - - - - - - - - -
    - - - - - - - - - - - - 0) : - foreach (jigoshop_cart::$cart_contents as $cart_item_key => $values) : - - if (isset($cart_totals[$cart_item_key]['qty'])) jigoshop_cart::set_quantity( $cart_item_key, $cart_totals[$cart_item_key]['qty'] ); - - endforeach; - endif; - - jigoshop::add_message( __('Cart updated.', 'jigoshop') ); - - endif; - -} - -/** - * Add to cart - **/ -add_action( 'init', 'jigoshop_add_to_cart_action' ); - -function jigoshop_add_to_cart_action( $url = false ) { - - if (isset($_GET['add-to-cart']) && $_GET['add-to-cart']) : - - if ( !jigoshop::verify_nonce('add_to_cart', '_GET') ) : - - elseif (is_numeric($_GET['add-to-cart'])) : - - $quantity = 1; - if (isset($_POST['quantity'])) $quantity = $_POST['quantity']; - jigoshop_cart::add_to_cart($_GET['add-to-cart'], $quantity); - - jigoshop::add_message( sprintf(__('View Cart → Product successfully added to your basket.', 'jigoshop'), jigoshop_cart::get_cart_url()) ); - - elseif ($_GET['add-to-cart']=='variation') : - - // Variation add to cart - if (isset($_POST['quantity']) && $_POST['quantity']) : - - $product_id = (int) $_GET['product']; - $quantity = ($_POST['quantity']) ? $_POST['quantity'] : 1; - $attributes = (array) maybe_unserialize( get_post_meta($product_id, 'product_attributes', true) ); - $variations = array(); - $all_variations_set = true; - $variation_id = 0; - - foreach ($attributes as $attribute) : - - if ( $attribute['variation']!=='yes' ) continue; - - if (isset($_POST[ 'tax_' . sanitize_title($attribute['name']) ]) && $_POST[ 'tax_' . sanitize_title($attribute['name']) ]) : - $variations['tax_' .sanitize_title($attribute['name'])] = $_POST[ 'tax_' . sanitize_title($attribute['name']) ]; - else : - $all_variations_set = false; - endif; - - endforeach; - - if (!$all_variations_set) : - jigoshop::add_error( __('Please choose product options…', 'jigoshop') ); - else : - // Find matching variation - $variation_id = jigoshop_find_variation( $variations ); - - if ($variation_id>0) : - // Add to cart - jigoshop_cart::add_to_cart($product_id, $quantity, $variations, $variation_id); - jigoshop::add_message( sprintf(__('View Cart → Product successfully added to your basket.', 'jigoshop'), jigoshop_cart::get_cart_url()) ); - else : - jigoshop::add_error( __('Sorry, this variation is not available.', 'jigoshop') ); - endif; - endif; - - elseif ($_GET['product']) : - - /* Link on product pages */ - jigoshop::add_error( __('Please choose product options…', 'jigoshop') ); - wp_redirect( get_permalink( $_GET['product'] ) ); - exit; - - endif; - - elseif ($_GET['add-to-cart']=='group') : - - // Group add to cart - if (isset($_POST['quantity']) && is_array($_POST['quantity'])) : - - $total_quantity = 0; - - foreach ($_POST['quantity'] as $item => $quantity) : - if ($quantity>0) : - jigoshop_cart::add_to_cart($item, $quantity); - jigoshop::add_message( sprintf(__('View Cart → Product successfully added to your basket.', 'jigoshop'), jigoshop_cart::get_cart_url()) ); - $total_quantity = $total_quantity + $quantity; - endif; - endforeach; - - if ($total_quantity==0) : - jigoshop::add_error( __('Please choose a quantity…', 'jigoshop') ); - endif; - - elseif ($_GET['product']) : - - /* Link on product pages */ - jigoshop::add_error( __('Please choose a product…', 'jigoshop') ); - wp_redirect( get_permalink( $_GET['product'] ) ); - exit; - - endif; - - endif; - - $url = apply_filters('add_to_cart_redirect', $url); - - // If has custom URL redirect there - if ( $url ) { - wp_safe_redirect( $url ); - exit; - } - - // Otherwise redirect to where they came - else if ( isset($_SERVER['HTTP_REFERER'])) { - wp_safe_redirect($_SERVER['HTTP_REFERER']); - exit; - } - - // If all else fails redirect to root - else { - wp_safe_redirect('/'); - exit; - } - endif; - -} - -/** - * Clear cart - **/ -add_action( 'wp_header', 'jigoshop_clear_cart_on_return' ); - -function jigoshop_clear_cart_on_return() { - - if (is_page(get_option('jigoshop_thanks_page_id'))) : - - if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0; - if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = ''; - if ($order_id > 0) : - $order = &new jigoshop_order( $order_id ); - if ($order->order_key == $order_key) : - jigoshop_cart::empty_cart(); - endif; - endif; - - endif; - -} - -/** - * Clear the cart after payment - order will be processing or complete - **/ -add_action( 'init', 'jigoshop_clear_cart_after_payment' ); - -function jigoshop_clear_cart_after_payment( $url = false ) { - - if (isset($_SESSION['order_awaiting_payment']) && $_SESSION['order_awaiting_payment'] > 0) : - - $order = &new jigoshop_order($_SESSION['order_awaiting_payment']); - - if ($order->id > 0 && ($order->status=='completed' || $order->status=='processing')) : - - jigoshop_cart::empty_cart(); - - unset($_SESSION['order_awaiting_payment']); - - endif; - - endif; - -} - - -/** - * Process the login form - **/ -add_action('init', 'jigoshop_process_login'); - -function jigoshop_process_login() { - - if (isset($_POST['login']) && $_POST['login']) : - - jigoshop::verify_nonce('login'); - - if ( !isset($_POST['username']) || empty($_POST['username']) ) jigoshop::add_error( __('Username is required.', 'jigoshop') ); - if ( !isset($_POST['password']) || empty($_POST['password']) ) jigoshop::add_error( __('Password is required.', 'jigoshop') ); - - if (jigoshop::error_count()==0) : - - $creds = array(); - $creds['user_login'] = $_POST['username']; - $creds['user_password'] = $_POST['password']; - $creds['remember'] = true; - $secure_cookie = is_ssl() ? true : false; - $user = wp_signon( $creds, $secure_cookie ); - if ( is_wp_error($user) ) : - jigoshop::add_error( $user->get_error_message() ); - else : - if ( isset($_SERVER['HTTP_REFERER'])) { - wp_safe_redirect($_SERVER['HTTP_REFERER']); - exit; - } - wp_redirect(get_permalink(get_option('jigoshop_myaccount_page_id'))); - exit; - endif; - - endif; - - endif; -} - -/** - * Process ajax checkout form - */ -add_action('wp_ajax_jigoshop-checkout', 'jigoshop_process_checkout'); -add_action('wp_ajax_nopriv_jigoshop-checkout', 'jigoshop_process_checkout'); - -function jigoshop_process_checkout () { - include_once jigoshop::plugin_path() . '/classes/jigoshop_checkout.class.php'; - - jigoshop_checkout::instance()->process_checkout(); - - die(0); -} - - -/** - * Cancel a pending order - hook into init function - **/ -add_action('init', 'jigoshop_cancel_order'); - -function jigoshop_cancel_order() { - - if ( isset($_GET['cancel_order']) && isset($_GET['order']) && isset($_GET['order_id']) ) : - - $order_key = urldecode( $_GET['order'] ); - $order_id = (int) $_GET['order_id']; - - $order = &new jigoshop_order( $order_id ); - - if ($order->id == $order_id && $order->order_key == $order_key && $order->status=='pending' && jigoshop::verify_nonce('cancel_order', '_GET')) : - - // Cancel the order + restore stock - $order->cancel_order( __('Order cancelled by customer.', 'jigoshop') ); - - // Message - jigoshop::add_message( __('Your order was cancelled.', 'jigoshop') ); - - elseif ($order->status!='pending') : - - jigoshop::add_error( __('Your order is no longer pending and could not be cancelled. Please contact us if you need assistance.', 'jigoshop') ); - - else : - - jigoshop::add_error( __('Invalid order.', 'jigoshop') ); - - endif; - - wp_safe_redirect(jigoshop_cart::get_cart_url()); - exit; - - endif; -} - - -/** - * Download a file - hook into init function - **/ -add_action('init', 'jigoshop_download_product'); - -function jigoshop_download_product() { - - if ( isset($_GET['download_file']) && isset($_GET['order']) && isset($_GET['email']) ) : - - global $wpdb; - - $download_file = (int) urldecode($_GET['download_file']); - $order = urldecode( $_GET['order'] ); - $email = urldecode( $_GET['email'] ); - - if (!is_email($email)) wp_safe_redirect( home_url() ); - - $downloads_remaining = $wpdb->get_var( $wpdb->prepare(" - SELECT downloads_remaining - FROM ".$wpdb->prefix."jigoshop_downloadable_product_permissions - WHERE user_email = '$email' - AND order_key = '$order' - AND product_id = '$download_file' - ;") ); - - if ($downloads_remaining=='0') : - wp_die( sprintf(__('Sorry, you have reached your download limit for this file. Go to homepage →', 'jigoshop'), home_url()) ); - else : - - if ($downloads_remaining>0) : - $wpdb->update( $wpdb->prefix . "jigoshop_downloadable_product_permissions", array( - 'downloads_remaining' => $downloads_remaining - 1, - ), array( - 'user_email' => $email, - 'order_key' => $order, - 'product_id' => $download_file - ), array( '%d' ), array( '%s', '%s', '%d' ) ); - endif; - - // Download the file - $file_path = ABSPATH . get_post_meta($download_file, 'file_path', true); - - $file_path = realpath($file_path); - - $file_extension = strtolower(substr(strrchr($file_path,"."),1)); - - switch ($file_extension) : - case "pdf": $ctype="application/pdf"; break; - case "exe": $ctype="application/octet-stream"; break; - case "zip": $ctype="application/zip"; break; - case "doc": $ctype="application/msword"; break; - case "xls": $ctype="application/vnd.ms-excel"; break; - case "ppt": $ctype="application/vnd.ms-powerpoint"; break; - case "gif": $ctype="image/gif"; break; - case "png": $ctype="image/png"; break; - case "jpe": case "jpeg": case "jpg": $ctype="image/jpg"; break; - default: $ctype="application/force-download"; - endswitch; - - if (!file_exists($file_path)) wp_die( sprintf(__('File not found. Go to homepage →', 'jigoshop'), home_url()) ); - - @ini_set('zlib.output_compression', 'Off'); - @set_time_limit(0); - @session_start(); - @session_cache_limiter('none'); - @set_magic_quotes_runtime(0); - @ob_end_clean(); - @session_write_close(); - - header("Pragma: no-cache"); - header("Expires: 0"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Robots: none"); - header("Content-Type: ".$ctype.""); - header("Content-Description: File Transfer"); - - if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { - // workaround for IE filename bug with multiple periods / multiple dots in filename - $iefilename = preg_replace('/\./', '%2e', basename($file_path), substr_count(basename($file_path), '.') - 1); - header("Content-Disposition: attachment; filename=\"".$iefilename."\";"); - } else { - header("Content-Disposition: attachment; filename=\"".basename($file_path)."\";"); - } - - header("Content-Transfer-Encoding: binary"); - - header("Content-Length: ".@filesize($file_path)); - @readfile("$file_path") or wp_die( sprintf(__('File not found. Go to homepage →', 'jigoshop'), home_url()) ); - exit; - - endif; - - endif; -} - - -/** - * Order Status completed - GIVE DOWNLOADABLE PRODUCT ACCESS TO CUSTOMER - **/ -add_action('order_status_completed', 'jigoshop_downloadable_product_permissions'); - -function jigoshop_downloadable_product_permissions( $order_id ) { - - global $wpdb; - - $order = &new jigoshop_order( $order_id ); - - if (sizeof($order->items)>0) foreach ($order->items as $item) : - - if ($item['id']>0) : - $_product = &new jigoshop_product( $item['id'] ); - - if ( $_product->exists && $_product->is_type('downloadable') ) : - - $user_email = $order->billing_email; - - if ($order->user_id>0) : - $user_info = get_userdata($order->user_id); - if ($user_info->user_email) : - $user_email = $user_info->user_email; - endif; - else : - $order->user_id = 0; - endif; - - $limit = trim(get_post_meta($_product->id, 'download_limit', true)); - - if (!empty($limit)) : - $limit = (int) $limit; - else : - $limit = ''; - endif; - - // Downloadable product - give access to the customer - $wpdb->insert( $wpdb->prefix . 'jigoshop_downloadable_product_permissions', array( - 'product_id' => $_product->id, - 'user_id' => $order->user_id, - 'user_email' => $user_email, - 'order_key' => $order->order_key, - 'downloads_remaining' => $limit - ), array( - '%s', - '%s', - '%s', - '%s', - '%s' - ) ); - - endif; - - endif; - - endforeach; -} \ No newline at end of file diff --git a/jigoshop_cron.php b/jigoshop_cron.php deleted file mode 100644 index 7dea69689b9..00000000000 --- a/jigoshop_cron.php +++ /dev/null @@ -1,52 +0,0 @@ -get_results(" - SELECT post_id FROM $wpdb->postmeta - WHERE meta_key = 'sale_price_dates_from' - AND meta_value < ".strtotime('NOW')." - "); - if ($on_sale) foreach ($on_sale as $product) : - - $data = unserialize( get_post_meta($product, 'product_data', true) ); - $price = get_post_meta($product, 'price', true); - - if ($data['sale_price'] && $price!==$data['sale_price']) update_post_meta($product, 'price', $data['sale_price']); - - endforeach; - - // Expired Sales - $sale_expired = $wpdb->get_results(" - SELECT post_id FROM $wpdb->postmeta - WHERE meta_key = 'sale_price_dates_to' - AND meta_value < ".strtotime('NOW')." - "); - if ($sale_expired) foreach ($sale_expired as $product) : - - $data = unserialize( get_post_meta($product, 'product_data', true) ); - $price = get_post_meta($product, 'price', true); - - if ($data['regular_price'] && $price!==$data['regular_price']) update_post_meta($product, 'price', $data['regular_price']); - - // Sale has expired - clear the schedule boxes - update_post_meta($product, 'sale_price_dates_from', ''); - update_post_meta($product, 'sale_price_dates_to', ''); - - endforeach; - -} - -function jigoshop_update_sale_prices_schedule_check(){ - wp_schedule_event(time(), 'daily', 'jigoshop_update_sale_prices_schedule_check'); - update_option('jigoshop_update_sale_prices', 'yes'); -} - -if (get_option('jigoshop_update_sale_prices')!='yes') jigoshop_update_sale_prices_schedule_check(); - -add_action('jigoshop_update_sale_prices_schedule_check', 'jigoshop_update_sale_prices'); \ No newline at end of file diff --git a/jigoshop_emails.php b/jigoshop_emails.php deleted file mode 100644 index 7fdc0cf61ef..00000000000 --- a/jigoshop_emails.php +++ /dev/null @@ -1,260 +0,0 @@ -id); - - $message = __("You have received an order from ",'jigoshop') . $order->billing_first_name . ' ' . $order->billing_last_name . __(". Their order is as follows:",'jigoshop') . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('ORDER #: ','jigoshop') . $order->id . '' . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->email_order_items_list( false, true ); - - if ($order->customer_note) : - $message .= PHP_EOL . __('Note:','jigoshop') .$order->customer_note . PHP_EOL; - endif; - - $message .= PHP_EOL . __('Subtotal:','jigoshop') . "\t\t\t" . $order->get_subtotal_to_display() . PHP_EOL; - if ($order->order_shipping > 0) $message .= __('Shipping:','jigoshop') . "\t\t\t" . $order->get_shipping_to_display() . PHP_EOL; - if ($order->order_discount > 0) $message .= __('Discount:','jigoshop') . "\t\t\t" . jigoshop_price($order->order_discount) . PHP_EOL; - if ($order->get_total_tax() > 0) $message .= __('Tax:','jigoshop') . "\t\t\t\t\t" . jigoshop_price($order->get_total_tax()) . PHP_EOL; - $message .= __('Total:','jigoshop') . "\t\t\t\t" . jigoshop_price($order->order_total) . ' - via ' . ucwords($order->payment_method) . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('CUSTOMER DETAILS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - if ($order->billing_email) $message .= __('Email:','jigoshop') . "\t\t\t\t" . $order->billing_email . PHP_EOL; - if ($order->billing_phone) $message .= __('Tel:','jigoshop') . "\t\t\t\t\t" . $order->billing_phone . PHP_EOL; - - $message .= PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('BILLING ADDRESS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->billing_first_name . ' ' . $order->billing_last_name . PHP_EOL; - if ($order->billing_company) $message .= $order->billing_company . PHP_EOL; - $message .= $order->formatted_billing_address . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('SHIPPING ADDRESS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->shipping_first_name . ' ' . $order->shipping_last_name . PHP_EOL; - if ($order->shipping_company) $message .= $order->shipping_company . PHP_EOL; - $message .= $order->formatted_shipping_address . PHP_EOL . PHP_EOL; - - $message = html_entity_decode( strip_tags( $message ) ); - - wp_mail( get_option('admin_email'), $subject, $message ); -} - - -/** - * Processing order notification email template - **/ -add_action('order_status_pending_to_processing', 'jigoshop_processing_order_customer_notification'); -add_action('order_status_pending_to_on-hold', 'jigoshop_processing_order_customer_notification'); - -function jigoshop_processing_order_customer_notification( $order_id ) { - - $order = &new jigoshop_order( $order_id ); - - $subject = '[' . get_bloginfo('name') . '] ' . __('Order Received','jigoshop'); - - $message = __("Thank you, we are now processing your order. Your order's details are below:",'jigoshop') . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('ORDER #: ','jigoshop') . $order->id . '' . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->email_order_items_list(); - - if ($order->customer_note) : - $message .= PHP_EOL . __('Note:','jigoshop') .$order->customer_note . PHP_EOL; - endif; - - $message .= PHP_EOL . __('Subtotal:','jigoshop') . "\t\t\t" . $order->get_subtotal_to_display() . PHP_EOL; - if ($order->order_shipping > 0) $message .= __('Shipping:','jigoshop') . "\t\t\t" . $order->get_shipping_to_display() . PHP_EOL; - if ($order->order_discount > 0) $message .= __('Discount:','jigoshop') . "\t\t\t" . jigoshop_price($order->order_discount) . PHP_EOL; - if ($order->get_total_tax() > 0) $message .= __('Tax:','jigoshop') . "\t\t\t\t\t" . jigoshop_price($order->get_total_tax()) . PHP_EOL; - $message .= __('Total:','jigoshop') . "\t\t\t\t" . jigoshop_price($order->order_total) . ' - via ' . ucwords($order->payment_method) . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('CUSTOMER DETAILS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - if ($order->billing_email) $message .= __('Email:','jigoshop') . "\t\t\t\t" . $order->billing_email . PHP_EOL; - if ($order->billing_phone) $message .= __('Tel:','jigoshop') . "\t\t\t\t\t" . $order->billing_phone . PHP_EOL; - - $message .= PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('BILLING ADDRESS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->billing_first_name . ' ' . $order->billing_last_name . PHP_EOL; - if ($order->billing_company) $message .= $order->billing_company . PHP_EOL; - $message .= $order->formatted_billing_address . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('SHIPPING ADDRESS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->shipping_first_name . ' ' . $order->shipping_last_name . PHP_EOL; - if ($order->shipping_company) $message .= $order->shipping_company . PHP_EOL; - $message .= $order->formatted_shipping_address . PHP_EOL . PHP_EOL; - - $message = html_entity_decode( strip_tags( $message ) ); - - wp_mail( $order->billing_email, $subject, $message ); -} - - -/** - * Completed order notification email template - this one includes download links for downloadable products - **/ -add_action('order_status_completed', 'jigoshop_completed_order_customer_notification'); - -function jigoshop_completed_order_customer_notification( $order_id ) { - - $order = &new jigoshop_order( $order_id ); - - $subject = '[' . get_bloginfo('name') . '] ' . __('Order Complete','jigoshop'); - - $message = __("Your order is complete. Your order's details are below:",'jigoshop') . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('ORDER #: ','jigoshop') . $order->id . '' . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->email_order_items_list( true ); - - if ($order->customer_note) : - $message .= PHP_EOL . __('Note:','jigoshop') .$order->customer_note . PHP_EOL; - endif; - - $message .= PHP_EOL . __('Subtotal:','jigoshop') . "\t\t\t" . $order->get_subtotal_to_display() . PHP_EOL; - if ($order->order_shipping > 0) $message .= __('Shipping:','jigoshop') . "\t\t\t" . $order->get_shipping_to_display() . PHP_EOL; - if ($order->order_discount > 0) $message .= __('Discount:','jigoshop') . "\t\t\t" . jigoshop_price($order->order_discount) . PHP_EOL; - if ($order->get_total_tax() > 0) $message .= __('Tax:','jigoshop') . "\t\t\t\t\t" . jigoshop_price($order->get_total_tax()) . PHP_EOL; - $message .= __('Total:','jigoshop') . "\t\t\t\t" . jigoshop_price($order->order_total) . ' - via ' . ucwords($order->payment_method) . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('CUSTOMER DETAILS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - if ($order->billing_email) $message .= __('Email:','jigoshop') . "\t\t\t\t" . $order->billing_email . PHP_EOL; - if ($order->billing_phone) $message .= __('Tel:','jigoshop') . "\t\t\t\t\t" . $order->billing_phone . PHP_EOL; - - $message .= PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('BILLING ADDRESS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->billing_first_name . ' ' . $order->billing_last_name . PHP_EOL; - if ($order->billing_company) $message .= $order->billing_company . PHP_EOL; - $message .= $order->formatted_billing_address . PHP_EOL . PHP_EOL; - - $message .= '=====================================================================' . PHP_EOL; - $message .= __('SHIPPING ADDRESS','jigoshop') . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->shipping_first_name . ' ' . $order->shipping_last_name . PHP_EOL; - if ($order->shipping_company) $message .= $order->shipping_company . PHP_EOL; - $message .= $order->formatted_shipping_address . PHP_EOL . PHP_EOL; - - $message = html_entity_decode( strip_tags( $message ) ); - - wp_mail( $order->billing_email, $subject, $message ); -} - - -/** - * Pay for order notification email template - this one includes a payment link - **/ -function jigoshop_pay_for_order_customer_notification( $order_id ) { - - $order = &new jigoshop_order( $order_id ); - - $subject = '[' . get_bloginfo('name') . '] ' . __('Pay for Order','jigoshop'); - - $customer_message = sprintf( __("An order has been created for you on “%s”. To pay for this order please use the following link: %s",'jigoshop') . PHP_EOL . PHP_EOL, get_bloginfo('name'), $order->get_checkout_payment_url() ); - - $message = '=====================================================================' . PHP_EOL; - $message .= __('ORDER #: ','jigoshop') . $order->id . '' . PHP_EOL; - $message .= '=====================================================================' . PHP_EOL; - - $message .= $order->email_order_items_list(); - - if ($order->customer_note) : - $message .= PHP_EOL . __('Note:','jigoshop') .$order->customer_note . PHP_EOL; - endif; - - $message .= PHP_EOL . __('Subtotal:','jigoshop') . "\t\t\t" . $order->get_subtotal_to_display() . PHP_EOL; - if ($order->order_shipping > 0) $message .= __('Shipping:','jigoshop') . "\t\t\t" . $order->get_shipping_to_display() . PHP_EOL; - if ($order->order_discount > 0) $message .= __('Discount:','jigoshop') . "\t\t\t" . jigoshop_price($order->order_discount) . PHP_EOL; - if ($order->get_total_tax() > 0) $message .= __('Tax:','jigoshop') . "\t\t\t\t\t" . jigoshop_price($order->get_total_tax()) . PHP_EOL; - $message .= __('Total:','jigoshop') . "\t\t\t\t" . jigoshop_price($order->order_total) . ' - via ' . ucwords($order->payment_method) . PHP_EOL . PHP_EOL; - - $customer_message = html_entity_decode( strip_tags( $customer_message.$message ) ); - - wp_mail( $order->billing_email, $subject, $customer_message ); -} - - -/** - * Low stock notification email - **/ -function jigoshop_low_stock_notification( $product ) { - $_product = &new jigoshop_product($product); - $subject = '[' . get_bloginfo('name') . '] ' . __('Product low in stock','jigoshop'); - $message = '#' . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('is low in stock.', 'jigoshop'); - $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); - wp_mail( get_option('admin_email'), $subject, $message ); -} - - -/** - * No stock notification email - **/ -function jigoshop_no_stock_notification( $product ) { - $_product = &new jigoshop_product($product); - $subject = '[' . get_bloginfo('name') . '] ' . __('Product out of stock','jigoshop'); - $message = '#' . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('is out of stock.', 'jigoshop'); - $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); - wp_mail( get_option('admin_email'), $subject, $message ); -} - - -/** - * Backorder notification email - **/ -function jigoshop_product_on_backorder_notification( $product, $amount ) { - $_product = &new jigoshop_product($product); - $subject = '[' . get_bloginfo('name') . '] ' . __('Product Backorder','jigoshop'); - $message = $amount . __(' units of #', 'jigoshop') . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('have been backordered.', 'jigoshop'); - $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); - wp_mail( get_option('admin_email'), $subject, $message ); -} \ No newline at end of file diff --git a/jigoshop_query.php b/jigoshop_query.php deleted file mode 100644 index 00e1b60e167..00000000000 --- a/jigoshop_query.php +++ /dev/null @@ -1,276 +0,0 @@ - $value) : - - if (!strstr($key, 'tax_')) continue; - - $variation_query[] = array( - 'key' => $key, - 'value' => array( $value ), - 'compare' => 'IN' - ); - - endforeach; - - // do the query - $args = array( - 'post_type' => 'product_variation', - 'orderby' => 'id', - 'order' => 'desc', - 'posts_per_page' => 1, - 'meta_query' => $variation_query - ); - $posts = get_posts( $args ); - - if (!$posts) : - - // Wildcard search - $variation_query = array(); - foreach ($variation_data as $key => $value) : - - if (!strstr($key, 'tax_')) continue; - - $variation_query[] = array( - 'key' => $key, - 'value' => array( $value, '' ), - 'compare' => 'IN' - ); - - endforeach; - $args['meta_query'] = $variation_query; - - $posts = get_posts( $args ); - - endif; - - if (!$posts) return false; - - return $posts[0]->ID; - -} - -### Get unfiltered list of posts in current view for use in loop + widgets - -function jigoshop_get_products_in_view() { - - global $all_post_ids; - - $all_post_ids = array(); - - if (is_tax( 'product_cat' ) || is_post_type_archive('product') || is_page( get_option('jigoshop_shop_page_id') ) || is_tax( 'product_tag' )) : - - $all_post_ids = jigoshop_get_post_ids(); - - endif; - - $all_post_ids[] = 0; - -} - -add_action('wp_head', 'jigoshop_get_products_in_view', 0); - -### Do Filters/Layered Nav - -function jigoshop_filter_loop() { - - global $wp_query, $all_post_ids; - - if (is_tax( 'product_cat' ) || is_post_type_archive('product') || is_page( get_option('jigoshop_shop_page_id') ) || is_tax( 'product_tag' )) : - - $filters = array(); - $filters = apply_filters('loop-shop-query', $filters); - - //$post_ids = jigoshop_get_post_ids(); - $post_ids = $all_post_ids; - $post_ids = apply_filters('loop-shop-posts-in', $post_ids); - $filters = array_merge($filters, array( - 'post__in' => $post_ids - )); - - $args = array_merge( $wp_query->query, $filters ); - - query_posts( $args ); - endif; -} - -add_action('wp_head', 'jigoshop_filter_loop'); - -### Layered Nav Init - -function jigoshop_layered_nav_init() { - - global $_chosen_attributes, $wpdb; - - $attribute_taxonomies = jigoshop::$attribute_taxonomies; - if ( $attribute_taxonomies ) : - foreach ($attribute_taxonomies as $tax) : - - $attribute = strtolower(sanitize_title($tax->attribute_name)); - $taxonomy = 'product_attribute_' . $attribute; - $name = 'filter_' . $attribute; - - if (isset($_GET[$name]) && taxonomy_exists($taxonomy)) $_chosen_attributes[$taxonomy] = explode(',', $_GET[$name] ); - - endforeach; - endif; - -} -add_action('init', 'jigoshop_layered_nav_init', 1); - - -### Get post ID's to filter from - -function jigoshop_get_post_ids() { - - global $wpdb; - - $in = array('visible'); - if (is_search()) $in[] = 'search'; - if (!is_search()) $in[] = 'catalog'; - - // WP Query to get all queried post ids - - global $wp_query; - - $args = array_merge( - $wp_query->query, - array( - 'page_id' => '', - 'posts_per_page' => -1, - 'post_type' => 'product', - 'post_status' => 'publish', - 'meta_query' => array( - array( - 'key' => 'visibility', - 'value' => $in, - 'compare' => 'IN' - ) - ) - ) - ); - $custom_query = new WP_Query( $args ); - - $queried_post_ids = array(); - - foreach ($custom_query->posts as $p) $queried_post_ids[] = $p->ID; - - wp_reset_query(); - - return $queried_post_ids; -} - -### Layered Nav - -function jigoshop_layered_nav_query( $filtered_posts ) { - - global $_chosen_attributes, $wpdb; - - if (sizeof($_chosen_attributes)>0) : - - $matched_products = array(); - $filtered = false; - - foreach ($_chosen_attributes as $attribute => $values) : - if (sizeof($values)>0) : - foreach ($values as $value) : - - $posts = get_objects_in_term( $value, $attribute ); - if (!is_wp_error($posts) && (sizeof($matched_products)>0 || $filtered)) : - $matched_products = array_intersect($posts, $matched_products); - elseif (!is_wp_error($posts)) : - $matched_products = $posts; - endif; - - $filtered = true; - - endforeach; - endif; - endforeach; - - if ($filtered) : - $matched_products[] = 0; - $filtered_posts = array_intersect($filtered_posts, $matched_products); - endif; - - endif; - - return $filtered_posts; -} - -add_filter('loop-shop-posts-in', 'jigoshop_layered_nav_query'); - - -### Price Filtering - -function jigoshop_price_filter( $filtered_posts ) { - - if (isset($_GET['max_price']) && isset($_GET['min_price'])) : - - $matched_products = array( 0 ); - - $matched_products_query = get_posts(array( - 'post_type' => 'product', - 'post_status' => 'publish', - 'posts_per_page' => -1, - 'meta_query' => array( - array( - 'key' => 'price', - 'value' => array( $_GET['min_price'], $_GET['max_price'] ), - 'type' => 'NUMERIC', - 'compare' => 'BETWEEN' - ) - ), - 'tax_query' => array( - array( - 'taxonomy' => 'product_type', - 'field' => 'slug', - 'terms' => 'grouped', - 'operator' => 'NOT IN' - ) - ) - )); - - if ($matched_products_query) : - - foreach ($matched_products_query as $product) : - $matched_products[] = $product->ID; - endforeach; - - endif; - - // Get grouped product ids - $grouped_products = get_objects_in_term( get_term_by('slug', 'grouped', 'product_type')->term_id, 'product_type' ); - - if ($grouped_products) foreach ($grouped_products as $grouped_product) : - - $children = get_children( 'post_parent='.$grouped_product.'&post_type=product' ); - - if ($children) foreach ($children as $product) : - $price = get_post_meta( $product->ID, 'price', true); - - if ($price<=$_GET['max_price'] && $price>=$_GET['min_price']) : - - $matched_products[] = $grouped_product; - - break; - - endif; - endforeach; - - endforeach; - - $filtered_posts = array_intersect($matched_products, $filtered_posts); - - endif; - - return $filtered_posts; -} - -add_filter('loop-shop-posts-in', 'jigoshop_price_filter'); \ No newline at end of file diff --git a/jigoshop_shortcodes.php b/jigoshop_shortcodes.php deleted file mode 100644 index 69defd85f1b..00000000000 --- a/jigoshop_shortcodes.php +++ /dev/null @@ -1,187 +0,0 @@ - '12', - 'columns' => '4', - 'orderby' => 'date', - 'order' => 'desc' - ), $atts)); - - $args = array( - 'post_type' => 'product', - 'post_status' => 'publish', - 'ignore_sticky_posts' => 1, - 'posts_per_page' => $per_page, - 'orderby' => $orderby, - 'order' => $order, - 'meta_query' => array( - array( - 'key' => 'visibility', - 'value' => array('catalog', 'visible'), - 'compare' => 'IN' - ) - ) - ); - - query_posts($args); - ob_start(); - jigoshop_get_template_part( 'loop', 'shop' ); - wp_reset_query(); - - return ob_get_clean(); -} - -### Multiple Products ######################################################### - -function jigoshop_products($atts){ - global $columns; - - if (empty($atts)) return; - - extract(shortcode_atts(array( - 'columns' => '4', - 'orderby' => 'title', - 'order' => 'asc' - ), $atts)); - - $args = array( - 'post_type' => 'product', - 'post_status' => 'publish', - 'ignore_sticky_posts' => 1, - 'orderby' => $orderby, - 'order' => $order, - 'meta_query' => array( - array( - 'key' => 'visibility', - 'value' => array('catalog', 'visible'), - 'compare' => 'IN' - ) - ) - ); - - if(isset($atts['skus'])){ - $skus = explode(',', $atts['skus']); - array_walk($skus, create_function('&$val', '$val = trim($val);')); - $args['meta_query'][] = array( - 'key' => 'sku', - 'value' => $skus, - 'compare' => 'IN' - ); - } - - if(isset($atts['ids'])){ - $ids = explode(',', $atts['ids']); - array_walk($ids, create_function('&$val', '$val = trim($val);')); - $args['post__in'] = $ids; - } - - query_posts($args); - - ob_start(); - jigoshop_get_template_part( 'loop', 'shop' ); - wp_reset_query(); - return ob_get_clean(); -} - -### Single Product ############################################################ - -function jigoshop_product($atts){ - if (empty($atts)) return; - - $args = array( - 'post_type' => 'product', - 'posts_per_page' => 1, - 'post_status' => 'publish', - 'meta_query' => array( - array( - 'key' => 'visibility', - 'value' => array('catalog', 'visible'), - 'compare' => 'IN' - ) - ) - ); - - if(isset($atts['sku'])){ - $args['meta_query'][] = array( - 'key' => 'sku', - 'value' => $atts['sku'], - 'compare' => '=' - ); - } - - if(isset($atts['id'])){ - $args['p'] = $atts['id']; - } - - query_posts($args); - - ob_start(); - jigoshop_get_template_part( 'loop', 'shop' ); - wp_reset_query(); - return ob_get_clean(); -} - -### Featured Products ######################################################### - -function jigoshop_featured_products( $atts ) { - - global $columns, $per_page; - - extract(shortcode_atts(array( - 'per_page' => '12', - 'columns' => '4', - 'orderby' => 'date', - 'order' => 'desc' - ), $atts)); - - $args = array( - 'post_type' => 'product', - 'post_status' => 'publish', - 'ignore_sticky_posts' => 1, - 'posts_per_page' => $per_page, - 'orderby' => $orderby, - 'order' => $order, - 'meta_query' => array( - array( - 'key' => 'visibility', - 'value' => array('catalog', 'visible'), - 'compare' => 'IN' - ), - array( - 'key' => 'featured', - 'value' => 'yes' - ) - ) - ); - query_posts($args); - ob_start(); - jigoshop_get_template_part( 'loop', 'shop' ); - wp_reset_query(); - - return ob_get_clean(); -} - -### Shortcodes ######################################################### - -add_shortcode('product', 'jigoshop_product'); -add_shortcode('products', 'jigoshop_products'); - -add_shortcode('recent_products', 'jigoshop_recent_products'); -add_shortcode('featured_products', 'jigoshop_featured_products'); - -add_shortcode('jigoshop_cart', 'get_jigoshop_cart'); -add_shortcode('jigoshop_checkout', 'get_jigoshop_checkout'); -add_shortcode('jigoshop_order_tracking', 'get_jigoshop_order_tracking'); -add_shortcode('jigoshop_my_account', 'get_jigoshop_my_account'); -add_shortcode('jigoshop_edit_address', 'get_jigoshop_edit_address'); -add_shortcode('jigoshop_change_password', 'get_jigoshop_change_password'); -add_shortcode('jigoshop_view_order', 'get_jigoshop_view_order'); -add_shortcode('jigoshop_pay', 'get_jigoshop_pay'); -add_shortcode('jigoshop_thankyou', 'get_jigoshop_thankyou'); diff --git a/jigoshop_taxonomy.php b/jigoshop_taxonomy.php deleted file mode 100644 index 93b7ce6c2ff..00000000000 --- a/jigoshop_taxonomy.php +++ /dev/null @@ -1,409 +0,0 @@ - true, - 'update_count_callback' => '_update_post_term_count', - 'labels' => array( - 'name' => __( 'Product Categories', 'jigoshop'), - 'singular_name' => __( 'Product Category', 'jigoshop'), - 'search_items' => __( 'Search Product Categories', 'jigoshop'), - 'all_items' => __( 'All Product Categories', 'jigoshop'), - 'parent_item' => __( 'Parent Product Category', 'jigoshop'), - 'parent_item_colon' => __( 'Parent Product Category:', 'jigoshop'), - 'edit_item' => __( 'Edit Product Category', 'jigoshop'), - 'update_item' => __( 'Update Product Category', 'jigoshop'), - 'add_new_item' => __( 'Add New Product Category', 'jigoshop'), - 'new_item_name' => __( 'New Product Category Name', 'jigoshop') - ), - 'show_ui' => true, - 'query_var' => true, - 'rewrite' => array( 'slug' => $category_base . _x('product-category', 'slug', 'jigoshop'), 'with_front' => false ), - ) - ); - - register_taxonomy( 'product_tag', - array('product'), - array( - 'hierarchical' => false, - 'labels' => array( - 'name' => __( 'Product Tags', 'jigoshop'), - 'singular_name' => __( 'Product Tag', 'jigoshop'), - 'search_items' => __( 'Search Product Tags', 'jigoshop'), - 'all_items' => __( 'All Product Tags', 'jigoshop'), - 'parent_item' => __( 'Parent Product Tag', 'jigoshop'), - 'parent_item_colon' => __( 'Parent Product Tag:', 'jigoshop'), - 'edit_item' => __( 'Edit Product Tag', 'jigoshop'), - 'update_item' => __( 'Update Product Tag', 'jigoshop'), - 'add_new_item' => __( 'Add New Product Tag', 'jigoshop'), - 'new_item_name' => __( 'New Product Tag Name', 'jigoshop') - ), - 'show_ui' => true, - 'query_var' => true, - 'rewrite' => array( 'slug' => $category_base . _x('product-tag', 'slug', 'jigoshop'), 'with_front' => false ), - ) - ); - - $attribute_taxonomies = jigoshop::$attribute_taxonomies; - if ( $attribute_taxonomies ) : - foreach ($attribute_taxonomies as $tax) : - - $name = 'product_attribute_'.strtolower(sanitize_title($tax->attribute_name)); - $hierarchical = true; - if ($name) : - - register_taxonomy( $name, - array('product'), - array( - 'hierarchical' => $hierarchical, - 'labels' => array( - 'name' => $tax->attribute_name, - 'singular_name' =>$tax->attribute_name, - 'search_items' => __( 'Search ', 'jigoshop') . $tax->attribute_name, - 'all_items' => __( 'All ', 'jigoshop') . $tax->attribute_name, - 'parent_item' => __( 'Parent ', 'jigoshop') . $tax->attribute_name, - 'parent_item_colon' => __( 'Parent ', 'jigoshop') . $tax->attribute_name . ':', - 'edit_item' => __( 'Edit ', 'jigoshop') . $tax->attribute_name, - 'update_item' => __( 'Update ', 'jigoshop') . $tax->attribute_name, - 'add_new_item' => __( 'Add New ', 'jigoshop') . $tax->attribute_name, - 'new_item_name' => __( 'New ', 'jigoshop') . $tax->attribute_name - ), - 'show_ui' => false, - 'query_var' => true, - 'show_in_nav_menus' => false, - 'rewrite' => array( 'slug' => $category_base . strtolower(sanitize_title($tax->attribute_name)), 'with_front' => false, 'hierarchical' => $hierarchical ), - ) - ); - - endif; - endforeach; - endif; - - register_post_type( "product", - array( - 'labels' => array( - 'name' => __( 'Products', 'jigoshop' ), - 'singular_name' => __( 'Product', 'jigoshop' ), - 'add_new' => __( 'Add Product', 'jigoshop' ), - 'add_new_item' => __( 'Add New Product', 'jigoshop' ), - 'edit' => __( 'Edit', 'jigoshop' ), - 'edit_item' => __( 'Edit Product', 'jigoshop' ), - 'new_item' => __( 'New Product', 'jigoshop' ), - 'view' => __( 'View Product', 'jigoshop' ), - 'view_item' => __( 'View Product', 'jigoshop' ), - 'search_items' => __( 'Search Products', 'jigoshop' ), - 'not_found' => __( 'No Products found', 'jigoshop' ), - 'not_found_in_trash' => __( 'No Products found in trash', 'jigoshop' ), - 'parent' => __( 'Parent Product', 'jigoshop' ) - ), - 'description' => __( 'This is where you can add new products to your store.', 'jigoshop' ), - 'public' => true, - 'show_ui' => true, - 'capability_type' => 'post', - 'publicly_queryable' => true, - 'exclude_from_search' => false, - 'menu_position' => 57, - 'hierarchical' => true, - 'rewrite' => array( 'slug' => $base_slug, 'with_front' => false ), - 'query_var' => true, - 'supports' => array( 'title', 'editor', 'thumbnail', 'comments'/*, 'page-attributes'*/ ), - 'has_archive' => $base_slug, - 'show_in_nav_menus' => false, - ) - ); - - register_post_type( "product_variation", - array( - 'labels' => array( - 'name' => __( 'Variations', 'jigoshop' ), - 'singular_name' => __( 'Variation', 'jigoshop' ), - 'add_new' => __( 'Add Variation', 'jigoshop' ), - 'add_new_item' => __( 'Add New Variation', 'jigoshop' ), - 'edit' => __( 'Edit', 'jigoshop' ), - 'edit_item' => __( 'Edit Variation', 'jigoshop' ), - 'new_item' => __( 'New Variation', 'jigoshop' ), - 'view' => __( 'View Variation', 'jigoshop' ), - 'view_item' => __( 'View Variation', 'jigoshop' ), - 'search_items' => __( 'Search Variations', 'jigoshop' ), - 'not_found' => __( 'No Variations found', 'jigoshop' ), - 'not_found_in_trash' => __( 'No Variations found in trash', 'jigoshop' ), - 'parent' => __( 'Parent Variation', 'jigoshop' ) - ), - 'public' => true, - 'show_ui' => true, - 'capability_type' => 'post', - 'publicly_queryable' => true, - 'exclude_from_search' => true, - 'hierarchical' => false, - 'rewrite' => false, - 'query_var' => true, - 'supports' => array( 'title', 'editor', 'custom-fields' ), - 'show_in_nav_menus' => false, - 'show_in_menu' => 'edit.php?post_type=product' - ) - ); - - register_taxonomy( 'product_type', - array('product'), - array( - 'hierarchical' => false, - 'show_ui' => false, - 'query_var' => true, - 'show_in_nav_menus' => false, - ) - ); - - register_post_type( "shop_order", - array( - 'labels' => array( - 'name' => __( 'Orders', 'jigoshop' ), - 'singular_name' => __( 'Order', 'jigoshop' ), - 'add_new' => __( 'Add Order', 'jigoshop' ), - 'add_new_item' => __( 'Add New Order', 'jigoshop' ), - 'edit' => __( 'Edit', 'jigoshop' ), - 'edit_item' => __( 'Edit Order', 'jigoshop' ), - 'new_item' => __( 'New Order', 'jigoshop' ), - 'view' => __( 'View Order', 'jigoshop' ), - 'view_item' => __( 'View Order', 'jigoshop' ), - 'search_items' => __( 'Search Orders', 'jigoshop' ), - 'not_found' => __( 'No Orders found', 'jigoshop' ), - 'not_found_in_trash' => __( 'No Orders found in trash', 'jigoshop' ), - 'parent' => __( 'Parent Orders', 'jigoshop' ) - ), - 'description' => __( 'This is where store orders are stored.', 'jigoshop' ), - 'public' => true, - 'show_ui' => true, - 'capability_type' => 'post', - 'publicly_queryable' => false, - 'exclude_from_search' => true, - 'menu_position' => 58, - 'hierarchical' => false, - 'show_in_nav_menus' => false, - 'rewrite' => false, - 'query_var' => true, - 'supports' => array( 'title', 'comments' ), - 'has_archive' => false - ) - ); - - register_taxonomy( 'shop_order_status', - array('shop_order'), - array( - 'hierarchical' => true, - 'update_count_callback' => '_update_post_term_count', - 'labels' => array( - 'name' => __( 'Order statuses', 'jigoshop'), - 'singular_name' => __( 'Order status', 'jigoshop'), - 'search_items' => __( 'Search Order statuses', 'jigoshop'), - 'all_items' => __( 'All Order statuses', 'jigoshop'), - 'parent_item' => __( 'Parent Order status', 'jigoshop'), - 'parent_item_colon' => __( 'Parent Order status:', 'jigoshop'), - 'edit_item' => __( 'Edit Order status', 'jigoshop'), - 'update_item' => __( 'Update Order status', 'jigoshop'), - 'add_new_item' => __( 'Add New Order status', 'jigoshop'), - 'new_item_name' => __( 'New Order status Name', 'jigoshop') - ), - 'show_ui' => false, - 'show_in_nav_menus' => false, - 'query_var' => true, - 'rewrite' => false, - ) - ); - - if (get_option('jigowatt_update_rewrite_rules')=='1') : - // Re-generate rewrite rules - global $wp_rewrite; - $wp_rewrite->flush_rules(); - update_option('jigowatt_update_rewrite_rules', '0'); - endif; - -} - -/** - * Categories ordering - */ - -/** - * Add a table to $wpdb to benefit from wordpress meta api - */ -function taxonomy_metadata_wpdbfix() { - global $wpdb; - $wpdb->jigoshop_termmeta = "{$wpdb->prefix}jigoshop_termmeta"; -} -add_action('init','taxonomy_metadata_wpdbfix'); -add_action('switch_blog','taxonomy_metadata_wpdbfix'); - -/** - * Add product_cat ordering to get_terms - * - * It enables the support a 'menu_order' parameter to get_terms for the product_cat taxonomy. - * By default it is 'ASC'. It accepts 'DESC' too - * - * To disable it, set it ot false (or 0) - * - */ -function jigoshop_terms_clauses($clauses, $taxonomies, $args ) { - global $wpdb; - - // wordpress should give us the taxonomies asked when calling the get_terms function - if( !in_array('product_cat', (array)$taxonomies) ) return $clauses; - - // query order - if( isset($args['menu_order']) && !$args['menu_order']) return $clauses; // menu_order is false so we do not add order clause - - // query fields - if( strpos('COUNT(*)', $clauses['fields']) === false ) $clauses['fields'] .= ', tm.* '; - - //query join - $clauses['join'] .= " LEFT JOIN {$wpdb->jigoshop_termmeta} AS tm ON (t.term_id = tm.jigoshop_term_id AND tm.meta_key = 'order') "; - - // default to ASC - if( ! isset($args['menu_order']) || ! in_array( strtoupper($args['menu_order']), array('ASC', 'DESC')) ) $args['menu_order'] = 'ASC'; - - $order = "ORDER BY CAST(tm.meta_value AS SIGNED) " . $args['menu_order']; - - if ( $clauses['orderby'] ): - $clauses['orderby'] = str_replace ('ORDER BY', $order . ',', $clauses['orderby'] ); - else: - $clauses['orderby'] = $order; - endif; - - return $clauses; -} -add_filter( 'terms_clauses', 'jigoshop_terms_clauses', 10, 3); - -/** - * Reorder on category insertion - * - * @param int $term_id - */ -function jigoshop_create_product_cat ($term_id) { - - $next_id = null; - - $term = get_term($term_id, 'product_cat'); - - // gets the sibling terms - $siblings = get_terms('product_cat', "parent={$term->parent}&menu_order=ASC&hide_empty=0"); - - foreach ($siblings as $sibling) { - if( $sibling->term_id == $term_id ) continue; - $next_id = $sibling->term_id; // first sibling term of the hierachy level - break; - } - - // reorder - jigoshop_order_categories ( $term, $next_id ); - -} -add_action("create_product_cat", 'jigoshop_create_product_cat'); - -/** - * Delete terms metas on deletion - * - * @param int $term_id - */ -function jigoshop_delete_product_cat($term_id) { - - $term_id = (int) $term_id; - - if(!$term_id) return; - - global $wpdb; - $wpdb->query("DELETE FROM {$wpdb->jigoshop_termmeta} WHERE `jigoshop_term_id` = " . $term_id); - -} -add_action("delete_product_cat", 'jigoshop_delete_product_cat'); - -/** - * Move a category before the a given element of its hierarchy level - * - * @param object $the_term - * @param int $next_id the id of the next slibling element in save hierachy level - * @param int $index - * @param int $terms - */ -function jigoshop_order_categories ( $the_term, $next_id, $index=0, $terms=null ) { - - if( ! $terms ) $terms = get_terms('product_cat', 'menu_order=ASC&hide_empty=0&parent=0'); - if( empty( $terms ) ) return $index; - - $id = $the_term->term_id; - - $term_in_level = false; // flag: is our term to order in this level of terms - - foreach ($terms as $term) { - - if( $term->term_id == $id ) { // our term to order, we skip - $term_in_level = true; - continue; // our term to order, we skip - } - // the nextid of our term to order, lets move our term here - if(null !== $next_id && $term->term_id == $next_id) { - $index++; - $index = jigoshop_set_category_order($id, $index, true); - } - - // set order - $index++; - $index = jigoshop_set_category_order($term->term_id, $index); - - // if that term has children we walk through them - $children = get_terms('product_cat', "parent={$term->term_id}&menu_order=ASC&hide_empty=0"); - if( !empty($children) ) { - $index = jigoshop_order_categories ( $the_term, $next_id, $index, $children ); - } - } - - // no nextid meaning our term is in last position - if( $term_in_level && null === $next_id ) - $index = jigoshop_set_category_order($id, $index+1, true); - - return $index; - -} - -/** - * Set the sort order of a category - * - * @param int $term_id - * @param int $index - * @param bool $recursive - */ -function jigoshop_set_category_order ($term_id, $index, $recursive=false) { - global $wpdb; - - $term_id = (int) $term_id; - $index = (int) $index; - - update_metadata('jigoshop_term', $term_id, 'order', $index); - - if( ! $recursive ) return $index; - - $children = get_terms('product_cat', "parent=$term_id&menu_order=ASC&hide_empty=0"); - - foreach ( $children as $term ) { - $index ++; - $index = jigoshop_set_category_order ($term->term_id, $index, true); - } - - return $index; - -} diff --git a/jigoshop_template_actions.php b/jigoshop_template_actions.php deleted file mode 100644 index 6e926758f5e..00000000000 --- a/jigoshop_template_actions.php +++ /dev/null @@ -1,79 +0,0 @@ - '', 'post_type' => 'product', 'paged' => $paged ) ); - - define('SHOP_IS_ON_FRONT', true); - - endif; - } -} -add_action('wp_head', 'jigoshop_front_page_archive', 0); - - -/** - * Content Wrappers - **/ -if (!function_exists('jigoshop_output_content_wrapper')) { - function jigoshop_output_content_wrapper() { - if( get_option('template') === 'twentyeleven' ) echo '
    '; - else echo '
    '; - } -} -if (!function_exists('jigoshop_output_content_wrapper_end')) { - function jigoshop_output_content_wrapper_end() { - if( get_option('template') === 'twentyeleven' ) echo '
    '; - else echo ''; - } -} - -/** - * Sale Flash - **/ -if (!function_exists('jigoshop_show_product_sale_flash')) { - function jigoshop_show_product_sale_flash( $post, $_product ) { - if ($_product->is_on_sale()) echo ''.__('Sale!', 'jigoshop').''; - } -} - -/** - * Sidebar - **/ -if (!function_exists('jigoshop_get_sidebar')) { - function jigoshop_get_sidebar() { - get_sidebar('shop'); - } -} - -/** - * Products Loop - **/ -if (!function_exists('jigoshop_template_loop_add_to_cart')) { - function jigoshop_template_loop_add_to_cart( $post, $_product ) { - ?>get_price_html(); ?>is_visible() && $post->post_parent > 0) : wp_safe_redirect(get_permalink($post->post_parent)); exit; endif; - if (!$_product->is_visible()) : wp_safe_redirect(home_url()); exit; endif; - } -} - -/** - * Before Single Products Summary Div - **/ -if (!function_exists('jigoshop_show_product_images')) { - function jigoshop_show_product_images() { - - global $_product, $post; - - echo '
    '; - - $thumb_id = 0; - if (has_post_thumbnail()) : - $thumb_id = get_post_thumbnail_id(); - $large_thumbnail_size = apply_filters('single_product_large_thumbnail_size', 'shop_large'); - echo ''; - the_post_thumbnail($large_thumbnail_size); - echo ''; - else : - echo 'Placeholder'; - endif; - - do_action('jigoshop_product_thumbnails'); - - echo '
    '; - - } -} -if (!function_exists('jigoshop_show_product_thumbnails')) { - function jigoshop_show_product_thumbnails() { - - global $_product, $post; - - echo '
    '; - - $thumb_id = get_post_thumbnail_id(); - $small_thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'shop_thumbnail'); - $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ); - $attachments = get_posts($args); - if ($attachments) : - $loop = 0; - $columns = 3; - foreach ( $attachments as $attachment ) : - - if ($thumb_id==$attachment->ID) continue; - - $loop++; - - $_post = & get_post( $attachment->ID ); - $url = wp_get_attachment_url($_post->ID); - $post_title = esc_attr($_post->post_title); - $image = wp_get_attachment_image($attachment->ID, $small_thumbnail_size); - - echo ''.$image.''; - - endforeach; - endif; - wp_reset_query(); - - echo '
    '; - - } -} - -/** - * After Single Products Summary Div - **/ -if (!function_exists('jigoshop_output_product_data_tabs')) { - function jigoshop_output_product_data_tabs() { - - if (isset($_COOKIE["current_tab"])) $current_tab = $_COOKIE["current_tab"]; else $current_tab = '#tab-description'; - - ?> -
    -
      - - - -
    - - - -
    -

    get_price_html(); ?>

    post_excerpt) echo wpautop(wptexturize($post->post_excerpt)); - } -} - -if (!function_exists('jigoshop_template_single_meta')) { - function jigoshop_template_single_meta( $post, $_product ) { - - ?> -
    is_type('simple') && get_option('jigoshop_enable_sku')=='yes') : ?>SKU: sku; ?>.get_categories( ', ', ' Posted in ', '.'); ?>get_tags( ', ', ' Tagged as ', '.'); ?>
    - - - - '; - endif; - - } -} - -/** - * Product Add to cart buttons - **/ -if (!function_exists('jigoshop_template_single_add_to_cart')) { - function jigoshop_template_single_add_to_cart( $post, $_product ) { - do_action( $_product->product_type . '_add_to_cart' ); - } -} -if (!function_exists('jigoshop_simple_add_to_cart')) { - function jigoshop_simple_add_to_cart() { - - global $_product; $availability = $_product->get_availability(); - - if ($availability['availability']) : ?>

    -
    -
    - - -
    - get_availability(); - - if ($availability['availability']) : ?>

    -
    - - -
    - -
    - - - children as $child) : $child_product = &new jigoshop_product( $child->ID ); $cavailability = $child_product->get_availability(); ?> - - - - - - - -
    get_price_html(); ?>
    - - -
    - ID, 'product_attributes', true) ); - if (!isset($attributes)) $attributes = array(); - - ?> -
    - - - - '; - - endforeach; - ?> - -
    -
    - - -
    - max_num_pages > 1 ) : - ?> - - -
  • >
  • - has_attributes()) : ?>
  • >
  • >
  • '; - echo '

    ' . apply_filters('jigoshop_product_description_heading', __('Product Description', 'jigoshop')) . '

    '; - the_content(); - echo ''; - } -} -if (!function_exists('jigoshop_product_attributes_panel')) { - function jigoshop_product_attributes_panel() { - global $_product; - echo '
    '; - echo '

    ' . apply_filters('jigoshop_product_description_heading', __('Additional Information', 'jigoshop')) . '

    '; - $_product->list_attributes(); - echo '
    '; - } -} -if (!function_exists('jigoshop_product_reviews_panel')) { - function jigoshop_product_reviews_panel() { - echo '
    '; - comments_template(); - echo '
    '; - } -} - - - -/** - * Jigoshop Product Thumbnail - **/ -if (!function_exists('jigoshop_get_product_thumbnail')) { - function jigoshop_get_product_thumbnail( $size = 'shop_small', $placeholder_width = 0, $placeholder_height = 0 ) { - - global $post; - - if (!$placeholder_width) $placeholder_width = jigoshop::get_var('shop_small_w'); - if (!$placeholder_height) $placeholder_height = jigoshop::get_var('shop_small_h'); - - if ( has_post_thumbnail() ) return get_the_post_thumbnail($post->ID, $size); else return 'Placeholder'; - - } -} - -/** - * Jigoshop Related Products - **/ -if (!function_exists('jigoshop_output_related_products')) { - function jigoshop_output_related_products() { - // 4 Related Products in 4 columns - jigoshop_related_products( 2, 2 ); - } -} - -if (!function_exists('jigoshop_related_products')) { - function jigoshop_related_products( $posts_per_page = 4, $post_columns = 4, $orderby = 'rand' ) { - - global $_product, $columns, $per_page; - - // Pass vars to loop - $per_page = $posts_per_page; - $columns = $post_columns; - - $related = $_product->get_related(); - if (sizeof($related)>0) : - echo ''; - endif; - wp_reset_query(); - - } -} - -/** - * Jigoshop Shipping Calculator - **/ -if (!function_exists('jigoshop_shipping_calculator')) { - function jigoshop_shipping_calculator() { - if (jigoshop_shipping::$enabled && get_option('jigoshop_enable_shipping_calc')=='yes' && jigoshop_cart::needs_shipping()) : - ?> -
    -

    -
    -

    - -

    -
    -

    - - - - - - - -

    -

    - -

    -
    -

    - -
    -
    - - -

    ', $wrap_after = '', $before = '', $after = '', $home = null ) { - - global $post, $wp_query, $author, $paged; - - if( !$home ) $home = _x('Home', 'breadcrumb', 'jigoshop'); - - $home_link = home_url(); - - $prepend = ''; - - if ( get_option('jigoshop_prepend_shop_page_to_urls')=="yes" && get_option('jigoshop_shop_page_id') && get_option('page_on_front') !== get_option('jigoshop_shop_page_id') ) - $prepend = $before . '' . get_the_title( get_option('jigoshop_shop_page_id') ) . ' ' . $after . $delimiter; - - - if ( (!is_home() && !is_front_page() && !(is_post_type_archive() && get_option('page_on_front')==get_option('jigoshop_shop_page_id'))) || is_paged() ) : - - echo $wrap_before; - - echo $before . '' . $home . ' ' . $after . $delimiter ; - - if ( is_category() ) : - - $cat_obj = $wp_query->get_queried_object(); - $this_category = $cat_obj->term_id; - $this_category = get_category( $this_category ); - if ($thisCat->parent != 0) : - $parent_category = get_category( $this_category->parent ); - echo get_category_parents($parent_category, TRUE, $delimiter ); - endif; - echo $before . single_cat_title('', false) . $after; - - elseif ( is_tax('product_cat') ) : - - //echo $before . '' . ucwords(get_option('jigoshop_shop_slug')) . '' . $after . $delimiter; - - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); - - $parents = array(); - $parent = $term->parent; - while ($parent): - $parents[] = $parent; - $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' )); - $parent = $new_parent->parent; - endwhile; - if(!empty($parents)): - $parents = array_reverse($parents); - foreach ($parents as $parent): - $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' )); - echo $before . '' . $item->name . '' . $after . $delimiter; - endforeach; - endif; - - $queried_object = $wp_query->get_queried_object(); - echo $prepend . $before . $queried_object->name . $after; - - elseif ( is_tax('product_tag') ) : - - $queried_object = $wp_query->get_queried_object(); - echo $prepend . $before . __('Products tagged “', 'jigoshop') . $queried_object->name . '”' . $after; - - elseif ( is_day() ) : - - echo $before . '' . get_the_time('Y') . '' . $after . $delimiter; - echo $before . '' . get_the_time('F') . '' . $after . $delimiter; - echo $before . get_the_time('d') . $after; - - elseif ( is_month() ) : - - echo $before . '' . get_the_time('Y') . '' . $after . $delimiter; - echo $before . get_the_time('F') . $after; - - elseif ( is_year() ) : - - echo $before . get_the_time('Y') . $after; - - elseif ( is_post_type_archive('product') && get_option('page_on_front') !== get_option('jigoshop_shop_page_id') ) : - - $_name = get_option('jigoshop_shop_page_id') ? get_the_title( get_option('jigoshop_shop_page_id') ) : ucwords(get_option('jigoshop_shop_slug')); - - if (is_search()) : - - echo $before . '' . $_name . '' . $delimiter . __('Search results for “', 'jigoshop') . get_search_query() . '”' . $after; - - else : - - echo $before . '' . $_name . '' . $after; - - endif; - - elseif ( is_single() && !is_attachment() ) : - - if ( get_post_type() == 'product' ) : - - //echo $before . '' . ucwords(get_option('jigoshop_shop_slug')) . '' . $after . $delimiter; - echo $prepend; - - if ($terms = wp_get_object_terms( $post->ID, 'product_cat' )) : - $term = current($terms); - $parents = array(); - $parent = $term->parent; - while ($parent): - $parents[] = $parent; - $new_parent = get_term_by( 'id', $parent, 'product_cat'); - $parent = $new_parent->parent; - endwhile; - if(!empty($parents)): - $parents = array_reverse($parents); - foreach ($parents as $parent): - $item = get_term_by( 'id', $parent, 'product_cat'); - echo $before . '' . $item->name . '' . $after . $delimiter; - endforeach; - endif; - echo $before . '' . $term->name . '' . $after . $delimiter; - endif; - - echo $before . get_the_title() . $after; - - elseif ( get_post_type() != 'post' ) : - $post_type = get_post_type_object(get_post_type()); - $slug = $post_type->rewrite; - echo $before . '' . $post_type->labels->singular_name . '' . $after . $delimiter; - echo $before . get_the_title() . $after; - else : - $cat = current(get_the_category()); - echo get_category_parents($cat, TRUE, $delimiter); - echo $before . get_the_title() . $after; - endif; - - elseif ( is_404() ) : - - echo $before . __('Error 404', 'jigoshop') . $after; - - elseif ( !is_single() && !is_page() && get_post_type() != 'post' ) : - - $post_type = get_post_type_object(get_post_type()); - if ($post_type) : echo $before . $post_type->labels->singular_name . $after; endif; - - elseif ( is_attachment() ) : - - $parent = get_post($post->post_parent); - $cat = get_the_category($parent->ID); $cat = $cat[0]; - echo get_category_parents($cat, TRUE, '' . $delimiter); - echo $before . '' . $parent->post_title . '' . $after . $delimiter; - echo $before . get_the_title() . $after; - - elseif ( is_page() && !$post->post_parent ) : - - echo $before . get_the_title() . $after; - - elseif ( is_page() && $post->post_parent ) : - - $parent_id = $post->post_parent; - $breadcrumbs = array(); - while ($parent_id) { - $page = get_page($parent_id); - $breadcrumbs[] = '' . get_the_title($page->ID) . ''; - $parent_id = $page->post_parent; - } - $breadcrumbs = array_reverse($breadcrumbs); - foreach ($breadcrumbs as $crumb) : - echo $crumb . '' . $delimiter; - endforeach; - echo $before . get_the_title() . $after; - - elseif ( is_search() ) : - - echo $before . __('Search results for “', 'jigoshop') . get_search_query() . '”' . $after; - - elseif ( is_tag() ) : - - echo $before . __('Posts tagged “', 'jigoshop') . single_tag_title('', false) . '”' . $after; - - elseif ( is_author() ) : - - $userdata = get_userdata($author); - echo $before . __('Author: ', 'jigoshop') . $userdata->display_name . $after; - - endif; - - if ( get_query_var('paged') ) : - - echo ' (' . __('Page', 'jigoshop') . ' ' . get_query_var('paged') .')'; - - endif; - - echo $wrap_after; - - endif; - - } -} - - -function jigoshop_body_classes ($classes) { - - if( ! is_singular('product') ) return $classes; - - $key = array_search('singular', $classes); - if ( $key !== false ) unset($classes[$key]); - return $classes; - -} diff --git a/jigoshop_templates.php b/jigoshop_templates.php deleted file mode 100644 index eae9fb47b53..00000000000 --- a/jigoshop_templates.php +++ /dev/null @@ -1,110 +0,0 @@ -get_error_message() ); - endif; - - jigoshop::show_messages(); - - if (sizeof(jigoshop_cart::$cart_contents)==0) : - echo '

    '.__('Your cart is empty.', 'jigoshop').'

    '; - return; - endif; - - ?> -
    - - - - - - - - - - - - - 0) : - foreach (jigoshop_cart::$cart_contents as $cart_item_key => $values) : - $_product = $values['data']; - if ($_product->exists() && $values['quantity']>0) : - echo ' - - - - - - - - '; - endif; - endforeach; - endif; - - do_action( 'jigoshop_shop_table_cart' ); - ?> - - - - -
    ×'; - - if ($values['variation_id'] && has_post_thumbnail($values['variation_id'])) echo get_the_post_thumbnail($values['variation_id'], 'shop_tiny'); - elseif (has_post_thumbnail($values['product_id'])) echo get_the_post_thumbnail($values['product_id'], 'shop_tiny'); - else echo 'Placeholder'; - - echo ' - ' . apply_filters('jigoshop_cart_product_title', $_product->get_title(), $_product) . ' - '.jigoshop_get_formatted_variation( $values['variation'] ).' - '.jigoshop_price($_product->get_price()).'
    '.jigoshop_price($_product->get_price()*$values['quantity']).'
    -
    - -
    - - -
    -
    -
    - - - -
    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - '.__('Sorry, it seems that there are no available shipping methods to your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop').'

    '; - endif; - ?> -
    - - - -
    - process_checkout(); - - $result = jigoshop_cart::check_cart_item_stock(); - - if (is_wp_error($result)) jigoshop::add_error( $result->get_error_message() ); - - if ( jigoshop::error_count()==0 && $non_js_checkout) jigoshop::add_message( __('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'jigoshop') ); - - jigoshop::show_messages(); - - jigoshop_get_template('checkout/form.php', false); - -} \ No newline at end of file diff --git a/shortcodes/my_account.php b/shortcodes/my_account.php deleted file mode 100644 index 4bfa4564524..00000000000 --- a/shortcodes/my_account.php +++ /dev/null @@ -1,520 +0,0 @@ - 5 - ), $atts)); - - $recent_orders = ('all' == $recent_orders) ? -1 : $recent_orders; - - global $post, $current_user; - - get_currentuserinfo(); - - jigoshop::show_messages(); - - if (is_user_logged_in()) : - - ?> -

    %s. From your account dashboard you can view your recent orders, manage your shipping and billing addresses and change your password.', 'jigoshop'), $current_user->display_name, get_permalink(get_option('jigoshop_change_password_page_id'))); ?>

    - - - -

    -
      - -
    • - -
    - - - -

    - - - - - - - - - - - - - get_customer_orders( get_current_user_id(), $recent_orders ); - if ($jigoshop_orders->orders) foreach ($jigoshop_orders->orders as $order) : - ?> - - - - - - - - - - -

    -

    -
    - -
    - -
    -

    - -
    -
    - countries[get_user_meta( get_current_user_id(), 'billing-country', true )])) $country = jigoshop_countries::$countries->countries[get_user_meta( get_current_user_id(), 'billing-country', true )]; else $country = ''; - $address = array( - get_user_meta( get_current_user_id(), 'billing-first_name', true ) . ' ' . get_user_meta( get_current_user_id(), 'billing-last_name', true ) - ,get_user_meta( get_current_user_id(), 'billing-company', true ) - ,get_user_meta( get_current_user_id(), 'billing-address', true ) - ,get_user_meta( get_current_user_id(), 'billing-address-2', true ) - ,get_user_meta( get_current_user_id(), 'billing-city', true ) - ,get_user_meta( get_current_user_id(), 'billing-state', true ) - ,get_user_meta( get_current_user_id(), 'billing-postcode', true ) - ,$country - ); - $address = array_map('trim', $address); - $formatted_address = array(); - foreach ($address as $part) if (!empty($part)) $formatted_address[] = $part; - $formatted_address = implode(', ', $formatted_address); - if (!$formatted_address) _e('You have not set up a billing address yet.', 'jigoshop'); else echo $formatted_address; - ?> -
    - -
    - -
    - -
    -

    - -
    -
    - countries[get_user_meta( get_current_user_id(), 'shipping-country', true )])) $country = jigoshop_countries::$countries->countries[get_user_meta( get_current_user_id(), 'shipping-country', true )]; else $country = ''; - $address = array( - get_user_meta( get_current_user_id(), 'shipping-first_name', true ) . ' ' . get_user_meta( get_current_user_id(), 'shipping-last_name', true ) - ,get_user_meta( get_current_user_id(), 'shipping-company', true ) - ,get_user_meta( get_current_user_id(), 'shipping-address', true ) - ,get_user_meta( get_current_user_id(), 'shipping-address-2', true ) - ,get_user_meta( get_current_user_id(), 'shipping-city', true ) - ,get_user_meta( get_current_user_id(), 'shipping-state', true ) - ,get_user_meta( get_current_user_id(), 'shipping-postcode', true ) - ,$country - ); - $address = array_map('trim', $address); - $formatted_address = array(); - foreach ($address as $part) if (!empty($part)) $formatted_address[] = $part; - $formatted_address = implode(', ', $formatted_address); - if (!$formatted_address) _e('You have not set up a shipping address yet.', 'jigoshop'); else echo $formatted_address; - ?> -
    - -
    - -
    - 0 && jigoshop::verify_nonce('edit_address') ) : - update_user_meta( $user_id, $load_address . '-first_name', jigowatt_clean($_POST['address-first_name']) ); - update_user_meta( $user_id, $load_address . '-last_name', jigowatt_clean($_POST['address-last_name']) ); - update_user_meta( $user_id, $load_address . '-company', jigowatt_clean($_POST['address-company']) ); - update_user_meta( $user_id, $load_address . '-email', jigowatt_clean($_POST['address-email']) ); - update_user_meta( $user_id, $load_address . '-address', jigowatt_clean($_POST['address-address']) ); - update_user_meta( $user_id, $load_address . '-address2', jigowatt_clean($_POST['address-address2']) ); - update_user_meta( $user_id, $load_address . '-city', jigowatt_clean($_POST['address-city']) ); - update_user_meta( $user_id, $load_address . '-postcode', jigowatt_clean($_POST['address-postcode']) ); - update_user_meta( $user_id, $load_address . '-country', jigowatt_clean($_POST['address-country']) ); - update_user_meta( $user_id, $load_address . '-state', jigowatt_clean($_POST['address-state']) ); - update_user_meta( $user_id, $load_address . '-phone', jigowatt_clean($_POST['address-phone']) ); - update_user_meta( $user_id, $load_address . '-fax', jigowatt_clean($_POST['address-fax']) ); - endif; - - wp_safe_redirect( get_permalink(get_option('jigoshop_myaccount_page_id')) ); - exit; - - endif; - - $address = array( - 'first_name' => get_user_meta( get_current_user_id(), $load_address . '-first_name', true ), - 'last_name' => get_user_meta( get_current_user_id(), $load_address . '-last_name', true ), - 'company' => get_user_meta( get_current_user_id(), $load_address . '-company', true ), - 'email' => get_user_meta( get_current_user_id(), $load_address . '-email', true ), - 'phone' => get_user_meta( get_current_user_id(), $load_address . '-phone', true ), - 'fax' => get_user_meta( get_current_user_id(), $load_address . '-fax', true ), - 'address' => get_user_meta( get_current_user_id(), $load_address . '-address', true ), - 'address2' => get_user_meta( get_current_user_id(), $load_address . '-address2', true ), - 'city' => get_user_meta( get_current_user_id(), $load_address . '-city', true ), - 'state' => get_user_meta( get_current_user_id(), $load_address . '-state', true ), - 'postcode' => get_user_meta( get_current_user_id(), $load_address . '-postcode', true ), - 'country' => get_user_meta( get_current_user_id(), $load_address . '-country', true ) - ); - ?> -
    - -

    - -

    - - -

    -

    - - -

    -
    - -

    - - -

    - -

    - - -

    -

    - - -

    -
    - -

    - - -

    -

    - - -

    -
    - -

    - - -

    -

    - - - - -

    -
    - - -

    - - -

    - -

    - - -

    -

    - - -

    -
    - - - - -
    - 0 && jigoshop::verify_nonce('change_password')) : - - if ( $_POST['password-1'] && $_POST['password-2'] ) : - - if ( $_POST['password-1']==$_POST['password-2'] ) : - - wp_update_user( array ('ID' => $user_id, 'user_pass' => $_POST['password-1']) ) ; - - wp_safe_redirect( get_permalink(get_option('jigoshop_myaccount_page_id')) ); - exit; - - else : - - jigoshop::add_error( __('Passwords do not match.','jigoshop') ); - - endif; - - else : - - jigoshop::add_error( __('Please enter your password.','jigoshop') ); - - endif; - - endif; - - endif; - - jigoshop::show_messages(); - - ?> -
    - -

    - - -

    -

    - - -

    -
    - -

    - -
    - 0 && $order->user_id == get_current_user_id() ) : - - echo '

    ' . sprintf( __('Order #%s made on %s', 'jigoshop'), $order->id, date('d.m.Y', strtotime($order->order_date)) ); - - echo sprintf( __('. Order status: %s', 'jigoshop'), $order->status ); - - echo '.

    '; - - ?> - - - - - - - - - - - - - - order_shipping>0) : ?> - - - - get_total_tax()>0) : ?> - - - - order_discount>0) : ?> - - - - - - - - customer_note) : ?> - - - - - - - - items)>0) : - - foreach($order->items as $item) : - - if (isset($item['variation_id']) && $item['variation_id'] > 0) : - $_product = &new jigoshop_product_variation( $item['variation_id'] ); - else : - $_product = &new jigoshop_product( $item['id'] ); - endif; - - echo ' - - - - - '; - endforeach; - endif; - ?> - -
    get_subtotal_to_display(); ?>
    get_shipping_to_display(); ?>
    get_total_tax()); ?>
    -order_discount); ?>
    order_total); ?>
    customer_note)); ?>
    '.$item['name']; - - if (isset($_product->variation_data)) : - echo jigoshop_get_formatted_variation( $_product->variation_data ); - endif; - - echo ' '.$item['qty'].''.jigoshop_price( $item['cost']*$item['qty'], array('ex_tax_label' => 1) ).'
    - -
    -

    -
    -
    - billing_email) echo '
    '.__('Email:', 'jigoshop').'
    '.$order->billing_email.'
    '; - if ($order->billing_phone) echo '
    '.__('Telephone:', 'jigoshop').'
    '.$order->billing_phone.'
    '; - ?> -
    - -
    - -
    - -
    -

    -
    -

    - formatted_shipping_address) _e('N/A', 'jigoshop'); else echo $order->formatted_shipping_address; - ?> -

    - -
    - -
    - -
    -

    -
    -

    - formatted_billing_address) _e('N/A', 'jigoshop'); else echo $order->formatted_billing_address; - ?> -

    - -
    - -
    - -
    - - 0) $order->id = (int) $_POST['orderid']; else $order->id = 0; - if (isset($_POST['order_email']) && $_POST['order_email']) $order_email = trim($_POST['order_email']); else $order_email = ''; - - if ( !jigoshop::verify_nonce('order_tracking') ): - - echo '

    '.__('You have taken too long. Please refresh the page and retry.', 'jigoshop').'

    '; - - elseif ($order->id && $order_email && $order->get_order( $order->id )) : - - if ($order->billing_email == $order_email) : - - echo '

    '.sprintf( __('Order #%s which was made %s has the status “%s”', 'jigoshop'), $order->id, human_time_diff(strtotime($order->order_date), current_time('timestamp')).__(' ago', 'jigoshop'), $order->status ); - - if ($order->status == 'completed') echo __(' and was completed ', 'jigoshop').human_time_diff(strtotime($order->completed_date), current_time('timestamp')).__(' ago', 'jigoshop'); - - echo '.

    '; - - ?> -

    - - - - - - - - - - - - - - - order_shipping>0) : ?> - - - - get_total_tax()>0) : ?> - - - - order_discount>0) : ?> - - - - - - - - - - items as $order_item) : - - if (isset($order_item['variation_id']) && $order_item['variation_id'] > 0) : - $_product = &new jigoshop_product_variation( $order_item['variation_id'] ); - else : - $_product = &new jigoshop_product( $order_item['id'] ); - endif; - - echo ''; - echo ''; - - echo ''; - echo ''; - echo ''; - - echo ''; - - endforeach; - ?> - -
    get_subtotal_to_display(); ?>
    get_shipping_to_display(); ?>
    get_total_tax()); ?>
    -order_discount); ?>
    order_total); ?>
    '.$_product->get_title(); - - if (isset($_product->variation_data)) : - echo jigoshop_get_formatted_variation( $_product->variation_data ); - endif; - - echo ''.$_product->sku.''.jigoshop_price($_product->get_price()).''.$order_item['qty'].'
    - -
    -

    -

    billing_first_name.' '.$order->billing_last_name.'
    '; - if ($order->billing_company) $address .= $order->billing_company.'
    '; - $address .= $order->formatted_billing_address; - echo $address; - ?>

    -
    -
    -

    -

    shipping_first_name.' '.$order->shipping_last_name.'
    '; - if ($order->shipping_company) $address .= $order->shipping_company.'
    '; - $address .= $order->formatted_shipping_address; - echo $address; - ?>

    -
    -
    - '.__('Sorry, we could not find that order id in our database. Want to retry?', 'jigoshop').'

    '; - endif; - else : - echo '

    '.__('Sorry, we could not find that order id in our database. Want to retry?', 'jigoshop').'

    '; - endif; - - else : - - ?> -
    - -

    - -

    -

    -
    -

    " />

    - -
    - id == $order_id && $order->order_key == $order_key && $order->status=='pending') : - - // Set customer location to order location - if ($order->billing_country) jigoshop_customer::set_country( $order->billing_country ); - if ($order->billing_state) jigoshop_customer::set_state( $order->billing_state ); - if ($order->billing_postcode) jigoshop_customer::set_postcode( $order->billing_postcode ); - - // Pay form was posted - process payment - if (isset($_POST['pay']) && jigoshop::verify_nonce('pay')) : - - // Update payment method - if ($order->order_total > 0 ) : - $payment_method = jigowatt_clean($_POST['payment_method']); - $data = (array) maybe_unserialize( get_post_meta( $order_id, 'order_data', true ) ); - $data['payment_method'] = $payment_method; - update_post_meta( $order_id, 'order_data', $data ); - - $available_gateways = jigoshop_payment_gateways::get_available_payment_gateways(); - - $result = $available_gateways[$payment_method]->process_payment( $order_id ); - - // Redirect to success/confirmation/payment page - if ($result['result']=='success') : - wp_safe_redirect( $result['redirect'] ); - exit; - endif; - else : - - // No payment was required for order - $order->payment_complete(); - wp_safe_redirect( get_permalink(get_option('jigoshop_thanks_page_id')) ); - exit; - - endif; - - endif; - - // Show messages - jigoshop::show_messages(); - - // Show form - jigoshop_pay_for_existing_order( $order ); - - elseif ($order->status!='pending') : - - jigoshop::add_error( __('Your order has already been paid for. Please contact us if you need assistance.', 'jigoshop') ); - - jigoshop::show_messages(); - - else : - - jigoshop::add_error( __('Invalid order.', 'jigoshop') ); - - jigoshop::show_messages(); - - endif; - - else : - - // Pay for order after checkout step - if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0; - if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = ''; - - if ($order_id > 0) : - - $order = &new jigoshop_order( $order_id ); - - if ($order->order_key == $order_key && $order->status=='pending') : - - ?> -
      -
    • - - # id; ?> -
    • -
    • - - order_date)); ?> -
    • -
    • - - order_total); ?> -
    • -
    • - - payment_method])) echo $gateways[$order->payment_method]->title; - else echo $order->payment_method; - ?> -
    • -
    - - payment_method, $order_id ); ?> - -
    - Thank you. Your order has been processed successfully.

    ', 'jigoshop'); - - // Pay for order after checkout step - if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0; - if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = ''; - - if ($order_id > 0) : - - $order = &new jigoshop_order( $order_id ); - - if ($order->order_key == $order_key) : - - ?> -
      -
    • - - # id; ?> -
    • -
    • - - order_date)); ?> -
    • -
    • - - order_total); ?> -
    • -
    • - - payment_method])) echo $gateways[$order->payment_method]->title; - else echo $order->payment_method; - ?> -
    • -
    -
    - payment_method, $order_id ); - - endif; - - endif; - -} \ No newline at end of file diff --git a/widgets/cart.php b/widgets/cart.php deleted file mode 100644 index d5f64b1bc74..00000000000 --- a/widgets/cart.php +++ /dev/null @@ -1,83 +0,0 @@ - __( "Shopping Cart for the sidebar.", 'jigoshop') ); - parent::WP_Widget('shopping_cart', __('Shopping Cart', 'jigoshop'), $widget_ops); - } - - /** @see WP_Widget::widget */ - function widget( $args, $instance ) { - - if (is_cart()) return; - - extract($args); - if ( !empty($instance['title']) ) $title = $instance['title']; else $title = __('Cart', 'jigoshop'); - $title = apply_filters('widget_title', $title, $instance, $this->id_base); - - echo $before_widget; - if ( $title ) echo $before_title . $title . $after_title; - - echo ''; - - if (sizeof(jigoshop_cart::$cart_contents)>0) : - echo '

    '; - - if (get_option('js_prices_include_tax')=='yes') : - _e('Total', 'jigoshop'); - else : - _e('Subtotal', 'jigoshop'); - endif; - - echo ': '.jigoshop_cart::get_cart_total(); - - echo '

    '; - - do_action( 'jigoshop_widget_shopping_cart_before_buttons' ); - - echo '

    '.__('View Cart →','jigoshop').' '.__('Checkout →','jigoshop').'

    '; - endif; - echo $after_widget; - } - - /** @see WP_Widget::update */ - function update( $new_instance, $old_instance ) { - $instance['title'] = strip_tags(stripslashes($new_instance['title'])); - return $instance; - } - - /** @see WP_Widget::form */ - function form( $instance ) { - ?> -

    -

    - 'widget_featured_products', 'description' => __( "Featured products on your site", 'jigoshop') ); - parent::WP_Widget('featured-products', __('Featured Products', 'jigoshop'), $widget_ops); - $this->alt_option_name = 'widget_featured_products'; - - add_action( 'save_post', array(&$this, 'flush_widget_cache') ); - add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); - add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); - } - - /** @see WP_Widget::widget */ - function widget($args, $instance) { - $cache = wp_cache_get('widget_featured_products', 'widget'); - - if ( !is_array($cache) ) $cache = array(); - - if ( isset($cache[$args['widget_id']]) ) { - echo $cache[$args['widget_id']]; - return; - } - - ob_start(); - extract($args); - - $title = apply_filters('widget_title', empty($instance['title']) ? __('Featured Products', 'jigoshop') : $instance['title'], $instance, $this->id_base); - if ( !$number = (int) $instance['number'] ) - $number = 10; - else if ( $number < 1 ) - $number = 1; - else if ( $number > 15 ) - $number = 15; - - $featured_posts = get_posts(array('numberposts' => $number, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => 'featured', 'meta_value' => 'yes' )); - if ($featured_posts) : -?> - - - - -flush_widget_cache(); - - $alloptions = wp_cache_get( 'alloptions', 'options' ); - if ( isset($alloptions['widget_featured_products']) ) delete_option('widget_featured_products'); - - return $instance; - } - - function flush_widget_cache() { - wp_cache_delete('widget_featured_products', 'widget'); - } - - /** @see WP_Widget::form */ - function form( $instance ) { - $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; - if ( !isset($instance['number']) || !$number = (int) $instance['number'] ) - $number = 2; -?> -

    -

    - -

    -

    - __( "Shows a custom attribute in a widget which lets you narrow down the list of shown products in categories.", 'jigoshop') ); - parent::WP_Widget('layered_nav', __('Layered Nav', 'jigoshop'), $widget_ops); - } - - /** @see WP_Widget::widget */ - function widget( $args, $instance ) { - extract($args); - - if (!is_tax( 'product_cat' ) && !is_post_type_archive('product') && !is_tax( 'product_tag' )) return; - - global $_chosen_attributes, $wpdb, $all_post_ids; - - $title = $instance['title']; - $taxonomy = 'product_attribute_'.strtolower(sanitize_title($instance['attribute'])); - - if (!taxonomy_exists($taxonomy)) return; - - $title = apply_filters('widget_title', $title, $instance, $this->id_base); - - $args = array( - 'hide_empty' => '1' - ); - $terms = get_terms( $taxonomy, $args ); - $count = count($terms); - if($count > 0){ - - $found = false; - ob_start(); - - echo $before_widget . $before_title . $title . $after_title; - - echo "
      "; - - // Reduce count based on chosen attributes - $all_post_ids = jigoshop_layered_nav_query( $all_post_ids ); - $all_post_ids = jigoshop_price_filter( $all_post_ids ); - - foreach ($terms as $term) { - - $_products_in_term = get_objects_in_term( $term->term_id, $taxonomy ); - - $count = sizeof(array_intersect($_products_in_term, $all_post_ids)); - - if ($count>0) $found = true; - - $class = ''; - - $arg = 'filter_'.strtolower(sanitize_title($instance['attribute'])); - - if (isset($_GET[ $arg ])) $current_filter = explode(',', $_GET[ $arg ]); else $current_filter = array(); - - if (!is_array($current_filter)) $current_filter = array(); - - if (!in_array($term->term_id, $current_filter)) $current_filter[] = $term->term_id; - - // Base Link decided by current page - if (defined('SHOP_IS_ON_FRONT')) : - $link = ''; - elseif (is_post_type_archive('product') || is_page( get_option('jigoshop_shop_page_id') )) : - $link = get_post_type_archive_link('product'); - else : - $link = get_term_link( get_query_var('term'), get_query_var('taxonomy') ); - endif; - - // All current filters - if ($_chosen_attributes) foreach ($_chosen_attributes as $name => $value) : - if ($name!==$taxonomy) : - $link = add_query_arg( strtolower(sanitize_title(str_replace('product_attribute_', 'filter_', $name))), implode(',', $value), $link ); - endif; - endforeach; - - // Min/Max - if (isset($_GET['min_price'])) : - $link = add_query_arg( 'min_price', $_GET['min_price'], $link ); - endif; - if (isset($_GET['max_price'])) : - $link = add_query_arg( 'max_price', $_GET['max_price'], $link ); - endif; - - // Current Filter = this widget - if (isset( $_chosen_attributes[$taxonomy] ) && is_array($_chosen_attributes[$taxonomy]) && in_array($term->term_id, $_chosen_attributes[$taxonomy])) : - $class = 'class="chosen"'; - else : - $link = add_query_arg( $arg, implode(',', $current_filter), $link ); - endif; - - // Search Arg - if (get_search_query()) : - $link = add_query_arg( 's', get_search_query(), $link ); - endif; - - // Post Type Arg - if (isset($_GET['post_type'])) : - $link = add_query_arg( 'post_type', $_GET['post_type'], $link ); - endif; - - echo '
    • '; - - if ($count>0) echo ''; else echo ''; - - echo $term->name; - - if ($count>0) echo ''; else echo ''; - - echo ' '.$count.'
    • '; - - } - - echo "
    "; - - echo $after_widget; - - if (!$found) : - ob_clean(); - return; - else : - $widget = ob_get_clean(); - echo $widget; - endif; - - } - } - - /** @see WP_Widget::update */ - function update( $new_instance, $old_instance ) { - if (!isset($new_instance['title']) || empty($new_instance['title'])) $new_instance['title'] = ucwords($new_instance['attribute']); - $instance['title'] = strip_tags(stripslashes($new_instance['title'])); - $instance['attribute'] = stripslashes($new_instance['attribute']); - return $instance; - } - - /** @see WP_Widget::form */ - function form( $instance ) { - global $wpdb; - ?> -

    -

    - -

    - - __( "Shows a price filter slider in a widget which lets you narrow down the list of shown products in categories.", 'jigoshop') ); - parent::WP_Widget('price_filter', __('Price Filter', 'jigoshop'), $widget_ops); - } - - /** @see WP_Widget::widget */ - function widget( $args, $instance ) { - extract($args); - - if (!is_tax( 'product_cat' ) && !is_post_type_archive('product') && !is_tax( 'product_tag' )) return; - - global $_chosen_attributes, $wpdb, $all_post_ids; - - $title = $instance['title']; - $title = apply_filters('widget_title', $title, $instance, $this->id_base); - - echo $before_widget . $before_title . $title . $after_title; - - // Remember current filters/search - $fields = ''; - - if (get_search_query()) $fields = ''; - if (isset($_GET['post_type'])) $fields .= ''; - - if ($_chosen_attributes) foreach ($_chosen_attributes as $attribute => $value) : - - $fields .= ''; - - endforeach; - - $min = 0; - - $max = ceil($wpdb->get_var("SELECT max(meta_value + 0) - FROM $wpdb->posts - LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id - WHERE meta_key = 'price' AND ( - $wpdb->posts.ID IN (".implode(',', $all_post_ids).") - OR ( - $wpdb->posts.post_parent IN (".implode(',', $all_post_ids).") - AND $wpdb->posts.post_parent != 0 - ) - )")); - - if (defined('SHOP_IS_ON_FRONT')) : - $link = ''; - elseif (is_post_type_archive('product') || is_page( get_option('jigoshop_shop_page_id') )) : - $link = get_post_type_archive_link('product'); - else : - $link = get_term_link( get_query_var('term'), get_query_var('taxonomy') ); - endif; - - echo '

    -
    -
    -
    - '.__('Price: ', 'jigoshop').' - - - '.$fields.' -
    -
    -
    '; - - echo $after_widget; - } - - /** @see WP_Widget::update */ - function update( $new_instance, $old_instance ) { - if (!isset($new_instance['title']) || empty($new_instance['title'])) $new_instance['title'] = __('Filter by price', 'jigoshop'); - $instance['title'] = strip_tags(stripslashes($new_instance['title'])); - return $instance; - } - - /** @see WP_Widget::form */ - function form( $instance ) { - global $wpdb; - ?> -

    -

    - 'widget_product_categories', 'description' => __( "A list or dropdown of product categories", 'jigoshop' ) ); - parent::WP_Widget('product_categories', __('Product Categories', 'jigoshop'), $widget_ops); - } - - /** @see WP_Widget::widget */ - function widget( $args, $instance ) { - extract( $args ); - - $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Product Categories', 'jigoshop' ) : $instance['title'], $instance, $this->id_base); - $c = $instance['count'] ? '1' : '0'; - $h = $instance['hierarchical'] ? '1' : '0'; - $d = $instance['dropdown'] ? '1' : '0'; - - echo $before_widget; - if ( $title ) - echo $before_title . $title . $after_title; - - $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'taxonomy' => 'product_cat'); - - if ( $d ) { - - $terms = get_terms('product_cat'); - $output = ""; - echo $output; - - ?> - - -
      - -
    - '') ); - $title = esc_attr( $instance['title'] ); - $count = isset($instance['count']) ? (bool) $instance['count'] :false; - $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false; - $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false; -?> -

    -

    - -

    /> -
    - - /> -
    - - /> -

    - __( "Search box for products only.", 'jigoshop') ); - parent::WP_Widget('product_search', __('Product Search', 'jigoshop'), $widget_ops); - } - - /** @see WP_Widget::widget */ - function widget( $args, $instance ) { - extract($args); - - $title = $instance['title']; - $title = apply_filters('widget_title', $title, $instance, $this->id_base); - - echo $before_widget; - - if ($title) echo $before_title . $title . $after_title; - - ?> - - -

    -

    - __( "Your most used product tags in cloud format", 'jigoshop') ); - parent::WP_Widget('tag_cloud', __('Product Tag Cloud', 'jigoshop'), $widget_ops); - } - - /** @see WP_Widget::widget */ - function widget( $args, $instance ) { - extract($args); - $current_taxonomy = $this->_get_current_taxonomy($instance); - if ( !empty($instance['title']) ) { - $title = $instance['title']; - } else { - if ( 'product_tag' == $current_taxonomy ) { - $title = __('Product Tags', 'jigoshop'); - } else { - $tax = get_taxonomy($current_taxonomy); - $title = $tax->labels->name; - } - } - $title = apply_filters('widget_title', $title, $instance, $this->id_base); - - echo $before_widget; - if ( $title ) - echo $before_title . $title . $after_title; - echo '
    '; - wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) ); - echo "
    \n"; - echo $after_widget; - } - - /** @see WP_Widget::update */ - function update( $new_instance, $old_instance ) { - $instance['title'] = strip_tags(stripslashes($new_instance['title'])); - $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); - return $instance; - } - - /** @see WP_Widget::form */ - function form( $instance ) { - $current_taxonomy = $this->_get_current_taxonomy($instance); -?> -

    -

    - 'widget_recent_entries', 'description' => __( "The most recent products on your site", 'jigoshop') ); - parent::WP_Widget('recent-products', __('New Products', 'jigoshop'), $widget_ops); - $this->alt_option_name = 'widget_recent_entries'; - - add_action( 'save_post', array(&$this, 'flush_widget_cache') ); - add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); - add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); - } - - /** @see WP_Widget::widget */ - function widget($args, $instance) { - $cache = wp_cache_get('widget_recent_products', 'widget'); - - if ( !is_array($cache) ) $cache = array(); - - if ( isset($cache[$args['widget_id']]) ) { - echo $cache[$args['widget_id']]; - return; - } - - ob_start(); - extract($args); - - $title = apply_filters('widget_title', empty($instance['title']) ? __('New Products', 'jigoshop') : $instance['title'], $instance, $this->id_base); - if ( !$number = (int) $instance['number'] ) - $number = 10; - else if ( $number < 1 ) - $number = 1; - else if ( $number > 15 ) - $number = 15; - - $show_variations = $instance['show_variations'] ? '1' : '0'; - - $args = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'post_type' => 'product'); - - if($show_variations=='0'){ - $args['meta_query'] = array( - array( - 'key' => 'visibility', - 'value' => array('catalog', 'visible'), - 'compare' => 'IN' - ) - ); - $args['parent'] = '0'; - } - - $r = new WP_Query($args); - - if ($r->have_posts()) : -?> - - -
      - have_posts()) : $r->the_post(); $_product = &new jigoshop_product(get_the_ID()); ?> -
    • - '; ?> - - get_price_html(); ?>
    • - -
    - -flush_widget_cache(); - - $alloptions = wp_cache_get( 'alloptions', 'options' ); - if ( isset($alloptions['widget_recent_products']) ) delete_option('widget_recent_products'); - - return $instance; - } - - function flush_widget_cache() { - wp_cache_delete('widget_recent_products', 'widget'); - } - - /** @see WP_Widget::form */ - function form( $instance ) { - $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; - if ( !isset($instance['number']) || !$number = (int) $instance['number'] ) - $number = 5; - - $show_variations = isset( $instance['show_variations'] ) ? (bool) $instance['show_variations'] : false; -?> -

    -

    - -

    -

    - -

    /> -
    - -