- Cambios
git-svn-id: https://192.168.0.254/svn/Proyectos.OriginalHouse_Web/trunk@11 54e8636e-a86c-764f-903d-b964358a1ae2
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
// This is a config file for PHPtidy
|
||||
// http://developer.berlios.de/projects/phptidy/
|
||||
|
||||
$project_files = array('*.php',
|
||||
'merchants/*.php',
|
||||
'shipping/*.php',
|
||||
'merchants/*.php',
|
||||
'updates/*.php',
|
||||
'widgets/*.php',
|
||||
'wpsc-includes/*.php',
|
||||
'wpsc-admin/*.php',
|
||||
'wpsc-admin/includes/*.php',
|
||||
'wpsc-admin/includes/settings-pages/*.php');
|
||||
|
||||
$default_package = "WP e-Commerce";
|
||||
$add_file_docblock = TRUE;
|
||||
$add_functions_docblock = TRUE;
|
||||
$add_doctags = TRUE;
|
||||
$fix_docblock_format = TRUE;
|
||||
$fix_docblock_space = TRUE;
|
||||
$add_blank_lines = FALSE;
|
||||
|
||||
?>
|
||||
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 65 B |
|
Before Width: | Height: | Size: 69 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
@ -1,281 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
@ -1,221 +0,0 @@
|
||||
=== WP e-Commerce ===
|
||||
Contributors: mufasa, jghazally, valentinas, mychelle
|
||||
Donate link: http://getshopped.org
|
||||
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
||||
Requires at least: 3.0
|
||||
Tested up to: 3.1.1
|
||||
Stable tag: 3.8.4
|
||||
|
||||
WP e-Commerce is a Web 2.0 application designed with usability, aesthetics, and presentation in mind.
|
||||
|
||||
== Description ==
|
||||
|
||||
The WP e-Commerce shopping cart plugin for WordPress is an elegant easy to use fully featured shopping cart application suitable for selling your products, services, and or fees online.
|
||||
|
||||
WP e-Commerce is a Web 2.0 application designed with usability, aesthetics, and presentation in mind.
|
||||
|
||||
Perfect for:
|
||||
|
||||
* Bands & Record Labels
|
||||
* Clothing Companies
|
||||
* Crafters & Artists
|
||||
* Books, DVDs & MP3 files
|
||||
* Memberships
|
||||
* Ticketing
|
||||
|
||||
For more information visit [http://getshopped.org](http://getshopped.org "http://getshopped.org")
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Upload the folder 'wp-e-commerce' to the '/wp-content/plugins/' directory
|
||||
2. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
|
||||
= Updating =
|
||||
|
||||
Before updating please make a backup of your existing files and database. Just in case.
|
||||
After upgrading from earlier versions look for link "Update Store". This will update your database structure to work with new version.
|
||||
|
||||
|
||||
== Changelog ==
|
||||
= 3.8.4 =
|
||||
* Add: User can duplicate a product in admin panel
|
||||
* Add: WooThemes integration support
|
||||
* Change: Total in Cart widget now excludes shipping and tax
|
||||
* Fix: Invalid country code in paypal-standard.merchant.php
|
||||
* Fix: Tax is not passed properly to Paypal Pro
|
||||
* Fix: Currency code preference not correctly selected in Paypal gateways
|
||||
* Fix: Paypal gateways doesn't check whether the currency being sent to Paypal is accepted or not, resulting in wrong currency
|
||||
* Fix: Checkout form selecting the wrong field when a previous field with the same uniquename was deleted
|
||||
* Fix: Various issues with Google Checkout
|
||||
* Fix: State data outside of US is not passed to payment gateways
|
||||
* Fix: State is not displaying correctly in the users purchase history
|
||||
* Fix: Wrong generated product permalink when a product is assigned multiple cats, and a product category is being viewed
|
||||
* Fix: Submitting a checkout form with mandatory billing state only refreshes the form although everything is filled out correctly
|
||||
* Fix: Billing Country is trimmed, and Billing State is not properly decoded
|
||||
* Fix: Billing and shipping state no longer stored correctly
|
||||
* Fix: Checkout form validation skips mandatory custom checkout fields on default form set
|
||||
* Fix: Paystation does not properly update purchase logs
|
||||
* Fix: When there's no product, and Sort Product By is set to 'dragndrop', viewing the admin product list would produce a Division by zero warning
|
||||
* Fix: Store sub-pages return 404 error
|
||||
* Fix: Only Purchase History in Your Account show the login option
|
||||
* Fix: Weight on Variations contain too many decimals
|
||||
* Fix: Add to Cart in grid view bypasses Variations selection
|
||||
* Fix: get_queried_object() requires WP 3.1
|
||||
* Fix: Invalid version number in display-update.page.php
|
||||
* Fix: Correct HTML, to stop Free Shipping Discount getting blanked
|
||||
* Fix: Support taxonomy archives for product_tag taxonomy
|
||||
|
||||
= 3.8.3 =
|
||||
* New: Individual item details are sent to Paypal Express Checkout
|
||||
* Change: Automatically reload database update page when PHP maximum execution time is detected
|
||||
* Change: Add progress bar and estimated time remaining for database update tasks
|
||||
* Change: Themes can now use taxonomy-wpsc_product_category-{$term}.php and taxonomy-wpsc_product_category.php templates, which take precedence over page.php when viewing a product category
|
||||
* Change: Paypal Express Checkout API is updated to ver 71.0
|
||||
* Fix: Tax is calculated incorrectly when a coupon is used
|
||||
* Fix: Update a large database of products and variations take ages
|
||||
* Fix: Reloading database update page makes wpec scan the records from the beginning instead of continuing where it left off
|
||||
* Fix: Reactivating the plugin causes Fatal Error (PHP Timeout) if there are a lot of attached images (not just post products, but all image attachments)
|
||||
* Fix: Purchase logs' statuses are not properly updated when upgrading from 3.7.x
|
||||
* Fix: Billing state is not sent to checkout
|
||||
* Fix: Country name is truncated when sending to payment gateway
|
||||
* Fix: Billing state code is not properly converted before sending to payment gateway
|
||||
* Fix: Wrong USA country code is sent to Paypal Standard Payment
|
||||
* Fix: Wrong sandbox gateway URL for Paypal Pro
|
||||
* Fix: SSLVERIFY error when connecting to Paypal Pro Gateway
|
||||
* Fix: Template hierarchy error with child themes
|
||||
* Fix: Total amount is not visible when checking out with Paypal Express Checkout
|
||||
* Fix: Transaction result page is inaccurate after checking out with Paypal Express Checkout
|
||||
* Fix: Incompatibility with Thesis theme's loop when viewing product category, or paginated product listing
|
||||
|
||||
= 3.8.2 =
|
||||
* Add: Currency display for Google RSS feed
|
||||
* Add: Third-party plugins can now filter 'wpsc-tax_rate' to provide their own tax solution
|
||||
* Change: Merchant subclasses now have access to $this->address_keys
|
||||
* Change: Grid Settings are now always visible
|
||||
* Change: Total Shipping is no longer included in notification email when shipping is disabled
|
||||
* Change: Thumbnail size for single product view now defaults to Single Product Page thumbnail size option
|
||||
* Change: wpsc_the_product_thumbnail() defaults to 'medium-single-product' size when in single product view
|
||||
* Fix: Update notice being displayed when it has already been completed
|
||||
* Fix: Broken image in latest products widget
|
||||
* Fix: Custom checkout field not always saved
|
||||
* Fix: Downloadable file list not updated after existing files are selected
|
||||
* Fix: Already attached downloadable files are duplicated each time you select an existing downloadable file
|
||||
* Fix: Inconsistent behavior when adding a new field to a checkout form set
|
||||
* Fix: Custom product slug not editable
|
||||
* Fix: Incompatibility issues with shipping helper and modules
|
||||
* Fix: Product meta are not included in Google product feed
|
||||
* Fix: Incorrect variation "from" price
|
||||
* Fix: Shortcode not working in single product description
|
||||
* Fix: Item cost not correctly calculated in paypal-standard-merchant
|
||||
* Fix: Invalid SSL URL for some images
|
||||
* Fix: Select from wrong table in WPSC_Merchant::get_authcode()
|
||||
* Fix: Wrong use of get_query_var() in wpsc_category_id()
|
||||
* Fix: Table `wordpress.wp_wpsc_product_list` doesn't exist
|
||||
* Fix: ?items_per_page=all is ignored
|
||||
* Fix: Duplicate transaction result emails
|
||||
* Fix: Wrong filter in wpsc_item_add_preview_file()
|
||||
* Fix: Wrong display type when using advanced search view mode and viewing a category
|
||||
* Fix: Category list is displayed in tag archive
|
||||
* Fix: wpsc_display_products_page() outputs "Fail" when the product shortcode is used 10 times (no kidding)
|
||||
* Fix: Single product view's thumbnail size is incorrect
|
||||
* Fix: Wrong featured thumbnail is displayed in Single Product View when there are multiple attached product images
|
||||
* Fix: Incorrect condition statements in WPSC_Coupons::compare_logic()
|
||||
* Fix: Can't add new field to checkout form set in IE
|
||||
* Fix: Missing trash icon when adding custom options to dropdowns in checkout form
|
||||
* Fix: Custom select, checkbox and radio fields are displayed as textbox on [userlog] page
|
||||
* Fix: Custom checkboxes, radios and select fields are not properly populated in Checkout form
|
||||
* Fix: Attachment metadata are not properly generated when converting product thumbnails from 3.7.x to 3.8
|
||||
|
||||
= 3.8.1 =
|
||||
* Fix: Special price mix-up when ugprade to 3.8
|
||||
* Fix: Missing database update notice
|
||||
* Fix: Breadcrumb markup and style fixes
|
||||
* Fix: Deprecate WPSC_Query()
|
||||
* Fix: Deprecate wpsc_total_product_count()
|
||||
* Fix: Deprecate wpsc_print_product_list()
|
||||
* Change: Warning message for PHP 4 users. GoldCart requires PHP 5 or above.
|
||||
* Change: Don't display categories when there's a search
|
||||
|
||||
= 3.8 =
|
||||
* Utilize custom post types for products
|
||||
* Utilize custom taxonomy for categories and variations
|
||||
* Database optimization
|
||||
* Redesigned taxes and shipping systems
|
||||
* New user interface
|
||||
* Integrates with WordPress Media Manager
|
||||
* Better template integration for designers
|
||||
* Optimized for ticketing (Tikipress)
|
||||
|
||||
= 3.7.5.3 =
|
||||
* Support for WordPress 2.9 canonical URLs for Products and Categories
|
||||
|
||||
= 3.7.5.2 =
|
||||
* More Fixes to the Paypal Pro merchant file
|
||||
* Image thumbnail size fixes
|
||||
* Updated readme to mark plugin as working with 2.9
|
||||
* Purchase log filtering bug fixed
|
||||
* Fix for a bug when no shipping module is used where the shipping country and region were not being changed
|
||||
* Remove button on checkout page now clears stock claims
|
||||
|
||||
= 3.7.5.1 =
|
||||
* Fixes to the Paypal Pro merchant file
|
||||
* Fixes to the Paypal Express Checkout merchant file
|
||||
* Tracking email improvements
|
||||
* HTML in descriptions does not break RSS (thanks to http://www.leewillis.co.uk)
|
||||
* Category permalinks will now be regenerated properly on instalation
|
||||
* Category list bug preventing viewing a product when viewing a category fixed.
|
||||
|
||||
|
||||
= 3.7.5 =
|
||||
* Added code for upgrades/additions from nielo.info and lsdev.biz, we will be using this for new modules in the future.
|
||||
* All In One SEO Pack compatibility bugfixes and improvements.
|
||||
* CSV has had some work done on it, it now takes larger files, and associates a CSV file to a single category of your choice. We'd love to be able to allow users to add the categories and images as part of the CSV file. We will look into it more at a later date.
|
||||
* SSL we fixed the image issue from beta1 and used James Collis recommended fix (using is_ssl() for our conditions) Thanks James!
|
||||
* Show list of Product Groupsí shows all Groups <- there may be some backwards compatibility issues (we havent encountered any but nevertheless if you spot any let us know)
|
||||
* When duplicating products, their tags do not get duplicated for the new product. <- Oh yes they DO!
|
||||
* Google Checkout now sends off Discount Coupons As well. And we fixed the `name` vs `code` Issue people mentioned in the forum
|
||||
* Category shortcode backwards compatibility
|
||||
* Fix Purchlogs - We had a lot of users that somehow by passed the 'fix purchase logs' page when upgrading from 3.6, so we added some better conditions to the mix and added it on to the debug page (a powerful wp-e-commerce page that is hidden from most users as it's usage is very corrosive backing up your DB and files is strongly recommended if not necessary when you work with this page).
|
||||
* Valid XHTML for front end of wpec YAY!
|
||||
* Fixed adding variations when adding products
|
||||
* Sender from the 'resend email to buyer' link on the purchase log details page has been fixed
|
||||
* Shipping Discount Bug that stopped shipping working at all.
|
||||
* Categories Widget has had numerous changes ñ
|
||||
* Better MU support.
|
||||
* Canadian Tax ñ Fixes
|
||||
* US Tax ñFixes
|
||||
* Product Categories Caching Issue Resolved
|
||||
* Coupons ñ ëApply to all Productsí and numerous bug fixes
|
||||
* ëYour Accountí done some fixes to it.
|
||||
* ëAccepted Paymentí goes straight to ëClosed Orderí
|
||||
* Stock claims are now cleared when the cart is emptied
|
||||
* Purchase log bulk actions now work
|
||||
* PayPal gateway module fixes and improvements
|
||||
* HTML Tables can now be added to product descriptions
|
||||
* Flat Rate and Weight Rate improvements
|
||||
|
||||
|
||||
= 3.7.4 =
|
||||
* Changes to shipping to fix the bugs from 3.7.3 with shipping and the new shipping_discount feature
|
||||
* Fixes for variations under grid view
|
||||
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= How do I customize WP e-Commerce =
|
||||
|
||||
First of all you should check out the Presentation settings which are in the Settings->Store page.
|
||||
|
||||
Advanced users can edit the CSS (and do just about anything). Not so advanced users can hire WP consultants developers and designers from [http://getshopped.org/resources/wp-consultants/](http://getshopped.org/resources/wp-consultants/ "http://getshopped.org/resources/wp-consultants/").
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. Products list in WordPress backend
|
||||
2. Edit Product screen
|
||||
3. Single product page
|
||||
4. Checkout page
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 3.8.1 =
|
||||
This version addresses several urgent issues when upgrading from 3.7.x to 3.8.
|
||||
|
Before Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 292 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 45 KiB |
@ -1,12 +0,0 @@
|
||||
/* CSS Document */
|
||||
|
||||
li.wpsc_presentation a{
|
||||
padding-left: 40px !important;
|
||||
background: url(../../wpsc-core/images/credit_cards.png) no-repeat;
|
||||
background-position: 12px center;
|
||||
}
|
||||
|
||||
iframe#wpsc-presentation{
|
||||
height: 2210px;
|
||||
width: 100%;
|
||||
}
|
||||
@ -1,155 +0,0 @@
|
||||
/* CSS Document */
|
||||
|
||||
*{
|
||||
font-family: 'Lucida Grande', Verdana, sans-serif;
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
h3{
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
display: block;
|
||||
border-bottom: solid 1px #e7e7e7;
|
||||
padding-bottom: 7px;
|
||||
}
|
||||
|
||||
tr{
|
||||
display: block;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
th[scope=row], th[score=row]{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
input[type=text]{
|
||||
border: solid #CCC #EEE #EEE #CCC;
|
||||
border-width: 1px;
|
||||
background-color: #fafafa;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-border-radius: 3px;
|
||||
padding: 5px;
|
||||
-webkit-bor
|
||||
}
|
||||
|
||||
input[type=text]:hover{
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.allign_top{
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.button_settings_th{
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.button_settings_desc{
|
||||
width: 260px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.product_settings_th{
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.product_page_settings_th, .product_category_settings_th, .thumbnail_settings_th{
|
||||
width: 260px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.shopping_cart_settings_th{
|
||||
width: 240px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.pagination_settings_th{
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.wpsc_select_wrapper{
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
background: #FAFAFA url(../../functions/images/select.png) no-repeat right center;
|
||||
border-color: #CCC #EEE #EEE #CCC;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
float: left;
|
||||
height: 26px;
|
||||
width: 280px;
|
||||
margin: 0;
|
||||
margin-bottom: 9px !important;
|
||||
display: block;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.wpsc_select{
|
||||
cursor: pointer;
|
||||
height: 28px;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
width: inherit;
|
||||
z-index: 4;
|
||||
|
||||
}
|
||||
|
||||
.wpsc_select_span{
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
.wpsc_select:hover{
|
||||
color: #333;
|
||||
background: white;
|
||||
}
|
||||
|
||||
input[type=submit][name=updateoption]{
|
||||
border-color: #BBB !important;
|
||||
cursor: pointer;
|
||||
background-color: #FAFAFA;
|
||||
border: 1px solid;
|
||||
padding: 5px;
|
||||
font-family: "Lucida Grande", Verdana, sans-serif;
|
||||
color: #555;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-border-radius: 4px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
input[type=submit][name=updateoption]:hover{
|
||||
border-color: #666 !important;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.comment_settings_th{
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#message{
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
right: 0px;
|
||||
display: block;
|
||||
width: 400px;
|
||||
text-align: center;
|
||||
background-color: #FFFFE0;
|
||||
border: 1px solid #E6DB55;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-border-radius: 4px;
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
// JavaScript Document
|
||||
$(document).ready(function() {
|
||||
//Button Settings Block
|
||||
$("h3:contains('Button Settings')").next().find('th[scope="row"]').addClass('button_settings_th allign_top');
|
||||
|
||||
var i = $("h3:contains('Button Settings')").next().find('td').first();
|
||||
i.html(i.html().replace('Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.',''));
|
||||
i.after("<td class='button_settings_desc'>Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.</td>");
|
||||
i.addClass('allign_top');
|
||||
|
||||
//Products Settings Block
|
||||
$("h3:contains('Product Settings')").next().find('th[scope="row"]').addClass('product_settings_th allign_top');
|
||||
$("h3:contains('Product Settings')").next().find('th[score="row"]').addClass('product_settings_th allign_top');
|
||||
|
||||
//Product Page Settings
|
||||
$("h3:contains('Product Page Settings')").next().find('th[scope="row"]').addClass('product_page_settings_th allign_top');
|
||||
|
||||
//Shopping Cart Settings
|
||||
$("h3:contains('Shopping Cart Settings')").next().find('th[scope="row"]').addClass('shopping_cart_settings_th allign_top');
|
||||
|
||||
//Product category Settings
|
||||
$("h3:contains('Product Category Settings')").next().find('th[scope="row"]').addClass('product_category_settings_th allign_top');
|
||||
|
||||
//Thumbnail Settings
|
||||
$("h3:contains('Thumbnail Settings')").next().next().find('th[scope="row"]').addClass('thumbnail_settings_th');
|
||||
|
||||
//Pagination Settings
|
||||
$("h3:contains('Pagination settings')").next().find('th[scope="row"]').addClass('pagination_settings_th');
|
||||
|
||||
//Comment Settings
|
||||
$("h3:contains('Comment Settings')").next().find('th[scope="row"]').addClass('comment_settings_th');
|
||||
|
||||
//Select control
|
||||
$("select").wrap('<div class="wpsc_select_wrapper" />');
|
||||
$("select").before('<span class="wpsc_select_span"></span>');
|
||||
$("select").addClass("wpsc_select");
|
||||
$("select").change(function (){
|
||||
$(this).prev().text($(this).find('option:selected').text());
|
||||
});
|
||||
|
||||
//Initialize select valua
|
||||
$("select").each(function(index, element) {
|
||||
$(this).prev().text($(this).find('option:selected').text());
|
||||
});
|
||||
|
||||
//Remove Advanced Theme Setting
|
||||
$('#themes_and_appearance').remove();
|
||||
|
||||
//Remove redundant 0 after the form
|
||||
$('body').html($('#cart_options'));
|
||||
});
|
||||
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo WPSC_URL; ?>/woo-integration/css/style.css"/>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo WPSC_URL; ?>/woo-integration/js/script.js"></script>
|
||||
<title>Dirty Options Presentaion</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/presentation.php' );
|
||||
echo wpsc_options_presentation();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
//Remove presentation tab on wpsc option menu
|
||||
function woo_wpsc_remove_presentation_tab($default_tabs){
|
||||
unset( $default_tabs['presentation'] );
|
||||
return $default_tabs;
|
||||
}
|
||||
|
||||
//Filter redirect url so that WPSC presentation page will loac correctly after update
|
||||
function woo_wpsc_filter_redirect_url($query){
|
||||
if ($_GET['page']=='woothemes'){
|
||||
$query = remove_query_arg('tab', $query);
|
||||
$query = add_query_arg( 'page' , 'woothemes' , $query);
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
//Print presentation menu subpage
|
||||
function woo_wpsc_filter_option($return){
|
||||
$return[1] .= '<li class="wpsc_presentation">
|
||||
<a title="WPSC_presentation" href="#wpsc-option-presentation">
|
||||
WPSC Presentation
|
||||
</a>
|
||||
</li>';
|
||||
|
||||
$return[0] .= ' <div class="group" id="wpsc-option-presentation">
|
||||
<iframe id="wpsc-presentation" src="'.get_bloginfo('wpurl').'/wp-admin/admin-ajax.php?action=print_wpsc_presentation">
|
||||
</iframe>
|
||||
</div>';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
//Ajax respont for wp_ajax_print_wpsc_presentation
|
||||
function woo_wpsc_presentation_menu(){
|
||||
require_once( WPSC_FILE_PATH . '/woo-integration/options_presentation.php' );
|
||||
}
|
||||
|
||||
//Add main frame style sheet
|
||||
function add_my_stylesheet() {
|
||||
wp_register_style('gb_admin_style', get_bloginfo('template_url') . '/wpsc/css/main_frame_style.css' );
|
||||
wp_enqueue_style('gb_admin_style');
|
||||
}
|
||||
|
||||
|
||||
function woo_wpsc_integration(){
|
||||
add_filter( 'wpsc_settings_tabs' , 'woo_wpsc_remove_presentation_tab');
|
||||
add_filter( 'woo_before_option_page' , 'woo_wpsc_filter_option');
|
||||
add_filter( 'wpsc_settings_redirect_url' , 'woo_wpsc_filter_redirect_url');
|
||||
add_action( 'wp_ajax_print_wpsc_presentation' , 'woo_wpsc_presentation_menu');
|
||||
add_action( 'admin_init' , 'add_my_stylesheet');
|
||||
}
|
||||
|
||||
function wpsc_detect_woo(){
|
||||
if (function_exists('woo_version')){
|
||||
woo_wpsc_integration();
|
||||
}
|
||||
}
|
||||
|
||||
add_action('after_setup_theme', 'wpsc_detect_woo');
|
||||
?>
|
||||
@ -1,169 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: WP e-Commerce
|
||||
* Plugin URI: http://getshopped.org/
|
||||
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
||||
* Version: 3.8.4
|
||||
* Author: Instinct Entertainment
|
||||
* Author URI: http://getshopped.org/
|
||||
**/
|
||||
|
||||
/**
|
||||
* WP_eCommerce
|
||||
*
|
||||
* Main WPEC Plugin Class
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
*/
|
||||
class WP_eCommerce {
|
||||
|
||||
/**
|
||||
* Start WPEC on plugins loaded
|
||||
*/
|
||||
function WP_eCommerce() {
|
||||
add_action( 'plugins_loaded', array( $this, 'init' ), 8 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes care of loading up WPEC
|
||||
*/
|
||||
function init() {
|
||||
// Previous to initializing
|
||||
do_action( 'wpsc_pre_init' );
|
||||
|
||||
// Initialize
|
||||
$this->start();
|
||||
$this->constants();
|
||||
$this->includes();
|
||||
$this->load();
|
||||
|
||||
// Finished initializing
|
||||
do_action( 'wpsc_init' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the basic WPEC constants
|
||||
*/
|
||||
function start() {
|
||||
// Set the core file path
|
||||
define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
|
||||
|
||||
// Define the path to the plugin folder
|
||||
define( 'WPSC_DIR_NAME', basename( WPSC_FILE_PATH ) );
|
||||
|
||||
// Define the URL to the plugin folder
|
||||
define( 'WPSC_FOLDER', dirname( plugin_basename( __FILE__ ) ) );
|
||||
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
||||
|
||||
//load text domain
|
||||
if( !load_plugin_textdomain( 'wpsc', false, '../languages/' ) )
|
||||
load_plugin_textdomain( 'wpsc', false, dirname( plugin_basename( __FILE__ ) ) . '/wpsc-languages/' );
|
||||
|
||||
// Finished starting
|
||||
do_action( 'wpsc_started' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the WPEC core constants
|
||||
*/
|
||||
function constants() {
|
||||
// Define globals and constants used by wp-e-commerce
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-constants.php' );
|
||||
|
||||
// Load the WPEC core constants
|
||||
wpsc_core_constants();
|
||||
|
||||
// Is WordPress Multisite
|
||||
wpsc_core_is_multisite();
|
||||
|
||||
// Start the wpsc session
|
||||
wpsc_core_load_session();
|
||||
|
||||
// Which version of WPEC
|
||||
wpsc_core_constants_version_processing();
|
||||
|
||||
// WPEC Table names and related constants
|
||||
wpsc_core_constants_table_names();
|
||||
|
||||
// Uploads directory info
|
||||
wpsc_core_constants_uploads();
|
||||
|
||||
// Any additional constants can hook in here
|
||||
do_action( 'wpsc_constants' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Include the rest of WPEC's files
|
||||
*/
|
||||
function includes() {
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-functions.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-includes.php' );
|
||||
|
||||
// Any additional file includes can hook in here
|
||||
do_action( 'wpsc_includes' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the WPEC core
|
||||
*/
|
||||
function load() {
|
||||
// Before setup
|
||||
do_action( 'wpsc_pre_load' );
|
||||
|
||||
// Legacy action
|
||||
do_action( 'wpsc_before_init' );
|
||||
|
||||
// Setup the core WPEC globals
|
||||
wpsc_core_setup_globals();
|
||||
|
||||
// Setup the core WPEC cart
|
||||
wpsc_core_setup_cart();
|
||||
|
||||
// Load the thumbnail sizes
|
||||
wpsc_core_load_thumbnail_sizes();
|
||||
|
||||
// Load the purchase log statuses
|
||||
wpsc_core_load_purchase_log_statuses();
|
||||
|
||||
// Load unique names and checout form types
|
||||
wpsc_core_load_checkout_data();
|
||||
|
||||
// Load the gateways
|
||||
wpsc_core_load_gateways();
|
||||
|
||||
// Load the shipping modules
|
||||
wpsc_core_load_shipping_modules();
|
||||
|
||||
// Set page title array for important WPSC pages
|
||||
wpsc_core_load_page_titles();
|
||||
|
||||
// WPEC is fully loaded
|
||||
do_action( 'wpsc_loaded' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPEC Activation Hook
|
||||
*/
|
||||
function install() {
|
||||
global $wp_version;
|
||||
if((float)$wp_version < 3.0){
|
||||
deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourselves
|
||||
wp_die( __('Looks like you\'re running an older version of WordPress, you need to be running at least WordPress 3.0 to use WP e-Commerce 3.8', 'wpsc'), __('WP e-Commerce 3.8 not compatible', 'wpsc'), array('back_link' => true));
|
||||
return;
|
||||
}
|
||||
define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
|
||||
$this->constants();
|
||||
wpsc_install();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Start WPEC
|
||||
$wpec = new WP_eCommerce();
|
||||
|
||||
// Activation
|
||||
register_activation_hook( __FILE__, array( $wpec, 'install' ) );
|
||||
|
||||
?>
|
||||
@ -1,467 +0,0 @@
|
||||
<?php
|
||||
function coupon_edit_form($coupon) {
|
||||
|
||||
$conditions = maybe_unserialize($coupon['condition']);
|
||||
|
||||
$start_timestamp = strtotime($coupon['start']);
|
||||
$end_timestamp = strtotime($coupon['expiry']);
|
||||
$id = $coupon['id'];
|
||||
$output = '';
|
||||
$output .= "<form name='edit_coupon' id='".$coupon['coupon_code']."' method='post' action=''>\n\r";
|
||||
$output .= "<table class='add-coupon'>\n\r";
|
||||
$output .= " <tr>\n\r";
|
||||
$output .= " <th>".__('Coupon Code', 'wpsc')."</th>\n\r";
|
||||
$output .= " <th>".__('Discount', 'wpsc')."</th>\n\r";
|
||||
$output .= " <th>".__('Start', 'wpsc')."</th>\n\r";
|
||||
$output .= " <th>".__('Expiry', 'wpsc')."</th>\n\r";
|
||||
$output .= " <th>".__('Use Once', 'wpsc')."</th>\n\r";
|
||||
$output .= " <th>".__('Active', 'wpsc')."</th>\n\r";
|
||||
$output .= " <th>".__('Apply On All Products', 'wpsc')."</th>\n\r";
|
||||
$output .= " <th></th>\n\r";
|
||||
$output .= " </tr>\n\r";
|
||||
$output .= " <tr>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
$output .= " <input type='hidden' value='true' name='is_edit_coupon' />\n\r";
|
||||
$output .= " <input type='text' size='11' value='".$coupon['coupon_code']."' name='edit_coupon[".$id."][coupon_code]' />\n\r";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
|
||||
$output .= " <input type='text' size='3' value='".$coupon['value']."' name=edit_coupon[".$id."][value]' />";
|
||||
$output .= " <select name='edit_coupon[".$id."][is-percentage]'>";
|
||||
$output .= " <option value='0' ".(($coupon['is-percentage'] == 0) ? "selected='true'" : '')." >$</option>\n\r";//
|
||||
$output .= " <option value='1' ".(($coupon['is-percentage'] == 1) ? "selected='true'" : '')." >%</option>\n\r";
|
||||
$output .= " <option value='2' ".(($coupon['is-percentage'] == 2) ? "selected='true'" : '')." >" . __( 'Free shipping', 'wpsc' ) . "'</option>\n\r";
|
||||
$output .= " </select>\n\r";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
$coupon_start = explode(" ",$coupon['start']);
|
||||
$output .= "<input type='text' class='pickdate' size='11' name='edit_coupon[".$id."][start]' value='{$coupon_start[0]}'>";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
$coupon_expiry = explode(" ",$coupon['expiry']);
|
||||
$output .= "<input type='text' class='pickdate' size='11' name='edit_coupon[".$id."][expiry]' value='{$coupon_expiry[0]}'>";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
$output .= " <input type='hidden' value='0' name='edit_coupon[".$id."][use-once]' />\n\r";
|
||||
$output .= " <input type='checkbox' value='1' ".(($coupon['use-once'] == 1) ? "checked='checked'" : '')." name='edit_coupon[".$id."][use-once]' />\n\r";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
$output .= " <input type='hidden' value='0' name='edit_coupon[".$id."][active]' />\n\r";
|
||||
$output .= " <input type='checkbox' value='1' ".(($coupon['active'] == 1) ? "checked='checked'" : '')." name='edit_coupon[".$id."][active]' />\n\r";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
$output .= " <input type='hidden' value='0' name='edit_coupon[".$id."][add_every_product]' />\n\r";
|
||||
$output .= " <input type='checkbox' value='1' ".(($coupon['every_product'] == 1) ? "checked='checked'" : '')." name='edit_coupon[".$id."][add_every_product]' />\n\r";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
$output .= " <input type='hidden' value='".$id."' name='edit_coupon[".$id."][id]' />\n\r";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " </tr>\n\r";
|
||||
|
||||
if($conditions != null){
|
||||
$output .= "<tr>";
|
||||
$output .= "<th>";
|
||||
$output .= __("Conditions", 'wpsc');
|
||||
$output .= "</th>";
|
||||
$output .= "</tr>";
|
||||
$output .= "<th>";
|
||||
$output .= __("Delete", 'wpsc');
|
||||
$output .= "</th>";
|
||||
$output .= "<th>";
|
||||
$output .= __("Property", 'wpsc');
|
||||
$output .= "</th>";
|
||||
$output .= "<th>";
|
||||
$output .= __("Logic", 'wpsc');
|
||||
$output .= "</th>";
|
||||
$output .= "<th>";
|
||||
$output .= __("Value", 'wpsc');
|
||||
$output .= "</th>";
|
||||
$output .= " </tr>\n\r";
|
||||
$i=0;
|
||||
foreach ($conditions as $condition){
|
||||
$output .= "<tr>";
|
||||
$output .= "<td>";
|
||||
$output .= "<input type='hidden' name='coupon_id' value='".$id."' />";
|
||||
$output .= "<input type='submit' id='delete_condition".$i."' style='display:none;' value='".$i."' name='delete_condition' />";
|
||||
$output .= "<span style='cursor:pointer;' class='delete_button' onclick='jQuery(\"#delete_condition".$i."\").click()'>" . __('Delete', 'wpsc' ) . "</span>";
|
||||
$output .= "</td>";
|
||||
$output .= "<td>";
|
||||
$output .= $condition['property'];
|
||||
$output .= "</td>";
|
||||
$output .= "<td>";
|
||||
$output .= $condition['logic'];
|
||||
$output .= "</td>";
|
||||
$output .= "<td>";
|
||||
$output .= $condition['value'];
|
||||
$output .= "</td>";
|
||||
$output .= "</tr>";
|
||||
$i++;
|
||||
}
|
||||
$output .= wpsc_coupons_conditions( $id);
|
||||
}elseif($conditions == null){
|
||||
$output .= wpsc_coupons_conditions( $id);
|
||||
|
||||
}
|
||||
$output .= "</table>\n\r";
|
||||
$output .= "</form>\n\r";
|
||||
echo $output;
|
||||
return $output;
|
||||
}
|
||||
function wpsc_coupons_conditions($id){
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
$output ='
|
||||
<input type="hidden" name="coupon_id" value="'.$id.'" />
|
||||
<tr><td colspan="3"><b>' . __( 'Add Conditions', 'wpsc') . '</b></td></tr>
|
||||
<tr><td colspan="6">
|
||||
<div class="coupon_condition">
|
||||
<div>
|
||||
<select class="ruleprops" name="rules[property][]">
|
||||
<option value="item_name" rel="order">' . __( 'Item name', 'wpsc') . '</option>
|
||||
<option value="item_quantity" rel="order">' . __( 'Item quantity', 'wpsc') . '</option>
|
||||
<option value="total_quantity" rel="order">' . __( 'Total quantity', 'wpsc') . '</option>
|
||||
<option value="subtotal_amount" rel="order">' . __( 'Subtotal amount', 'wpsc') . '</option>
|
||||
' . apply_filters( 'wpsc_coupon_rule_property_options', '' ) . '
|
||||
</select>
|
||||
<select name="rules[logic][]">
|
||||
<option value="equal">' . __( 'Is equal to', 'wpsc') . '</option>
|
||||
<option value="greater">' . __( 'Is greater than', 'wpsc') . '</option>
|
||||
<option value="less">' . __( 'Is less than', 'wpsc') . '</option>
|
||||
<option value="contains">' . __( 'Contains', 'wpsc') . '</option>
|
||||
<option value="not_contain">' . __( 'Does not contain', 'wpsc') . '</option>
|
||||
<option value="begins">' . __( 'Begins with', 'wpsc') . '</option>
|
||||
<option value="ends">' . __( 'Ends with', 'wpsc') . '</option>
|
||||
</select>
|
||||
<span>
|
||||
<input type="text" name="rules[value][]"/>
|
||||
</span>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
|
||||
<input type="submit" value="'.__("Update Coupon", "wpsc").'" class="button-primary" name="edit_coupon['.$id.'][submit_coupon]" />';
|
||||
|
||||
$nonced_url = wp_nonce_url("admin.php?wpsc_admin_action=wpsc-delete-coupon&delete_id=$id", 'delete-coupon');
|
||||
|
||||
$output.= "<a class='delete_button' style='text-decoration:none;' href=" .$nonced_url."> Delete</a>";
|
||||
|
||||
$output.='
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
return $output;
|
||||
|
||||
}
|
||||
function setting_button(){
|
||||
$next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
|
||||
|
||||
// $output.="<div><img src='".get_option('siteurl')."/wp-content/plugins/".WPSC_DIR_NAME."/images/settings_button.jpg' onclick='display_settings_button()'>";
|
||||
$output.="<div style='float: right; margin-top: 0px; position: relative;'> | <a href='#' onclick='display_settings_button(); return false;' style='text-decoration: underline;'>".__('Settings', 'wpsc')." »</a>";
|
||||
$output.="<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
|
||||
$output.="<ul class='settings_button'>";
|
||||
|
||||
$output.="<li><a href='admin.php?page=wpsc-settings'>".__('Shop Settings', 'wpsc')."</a></li>";
|
||||
$output.="<li><a href='admin.php?page=wpsc-settings&tab=gateway'>".__('Money and Payment', 'wpsc')."</a></li>";
|
||||
$output.="<li><a href='admin.php?page=wpsc-settings&tab=checkout'>".__('Checkout Page Settings', 'wpsc')."</a></li>";
|
||||
$output.="</ul>";
|
||||
$output.="</span>  </div>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function wpsc_right_now() {
|
||||
global $wpdb;
|
||||
$year = date("Y");
|
||||
$month = date("m");
|
||||
$start_timestamp = mktime(0, 0, 0, $month, 1, $year);
|
||||
$end_timestamp = mktime(0, 0, 0, ($month+1), 0, $year);
|
||||
$product_count = $wpdb->get_var("SELECT COUNT(*)
|
||||
FROM `".$wpdb->posts."`
|
||||
WHERE `post_status` = 'publish'
|
||||
AND `post_type` = 'wpsc-product'"
|
||||
);
|
||||
$group_count = count(get_terms("wpsc_product_category"));
|
||||
$sales_count = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `date` BETWEEN '".$start_timestamp."' AND '".$end_timestamp."'");
|
||||
$monthtotal = wpsc_currency_display( admin_display_total_price( $start_timestamp,$end_timestamp ) );
|
||||
$overaltotal = wpsc_currency_display( admin_display_total_price() );
|
||||
$variation_count = count(get_terms("wpsc-variation", array('parent' => 0)));
|
||||
$pending_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('1','2')");
|
||||
$accept_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('3' ,'4', '5')");
|
||||
$theme = get_option('wpsc_selected_theme');
|
||||
?>
|
||||
<div class='table'>
|
||||
<p class='sub'><?php _e('At a Glance', 'wpsc'); ?></p>
|
||||
<table style='border-top:1px solid #ececec;'>
|
||||
<tr class='first'>
|
||||
<td class='first b'>
|
||||
<?php echo $product_count; ?>
|
||||
</td>
|
||||
<td class='t'>
|
||||
<?php echo _nx( 'Product', 'Products', $product_count, 'dashboard widget', 'wpsc' ); ?>
|
||||
</td>
|
||||
<td class='b'>
|
||||
<?php echo $sales_count; ?>
|
||||
</td>
|
||||
<td class='last'>
|
||||
<?php echo _nx('Sale', 'Sales', $sales_count, 'dashboard widget', 'wpsc'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='first b'>
|
||||
<?php echo $group_count; ?>
|
||||
</td>
|
||||
<td class='t'>
|
||||
<?php echo _nx('Category', 'Categories', $group_count, 'dashboard widget', 'wpsc'); ?>
|
||||
</td>
|
||||
<td class='b'>
|
||||
<?php echo $pending_sales; ?>
|
||||
</td>
|
||||
<td class='last t waiting'>
|
||||
<?php echo _n('Pending sale', 'Pending sales', $pending_sales, 'wpsc'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='first b'>
|
||||
<?php echo $variation_count; ?>
|
||||
</td>
|
||||
<td class='t'>
|
||||
<?php echo _nx('Variation', 'Variations', $variation_count, 'dashboard widget', 'wpsc'); ?>
|
||||
</td>
|
||||
<td class='b'>
|
||||
<?php echo $accept_sales; ?>
|
||||
</td>
|
||||
<td class='last t approved'>
|
||||
<?php echo _n('Closed sale', 'Closed sales', $accept_sales, 'wpsc'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
function wpsc_packing_slip($purchase_id) {
|
||||
echo "<!DOCTYPE html><html><head><title>" . __( 'Packing Slip', 'wpsc' ) . "</title></head><body id='wpsc-packing-slip'>";
|
||||
global $wpdb;
|
||||
$purch_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id`='".$purchase_id."'";
|
||||
$purch_data = $wpdb->get_row($purch_sql,ARRAY_A) ;
|
||||
|
||||
//echo "<p style='padding-left: 5px;'><strong>".__('Date', 'wpsc')."</strong>:".date("jS M Y", $purch_data['date'])."</p>";
|
||||
|
||||
$cartsql = "SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid`=".$purchase_id."";
|
||||
$cart_log = $wpdb->get_results($cartsql,ARRAY_A) ;
|
||||
$j = 0;
|
||||
|
||||
if($cart_log != null) {
|
||||
echo "<div class='packing_slip'>\n\r";
|
||||
echo apply_filters( 'wpsc_packing_slip_header', '<h2>' . __( 'Packing Slip', 'wpsc' ) . "</h2>\n\r" );
|
||||
echo "<strong>".__('Order', 'wpsc')." #</strong> ".$purchase_id."<br /><br />\n\r";
|
||||
|
||||
echo "<table>\n\r";
|
||||
|
||||
$form_sql = "SELECT * FROM `".WPSC_TABLE_SUBMITED_FORM_DATA."` WHERE `log_id` = '".(int)$purchase_id."'";
|
||||
$input_data = $wpdb->get_results($form_sql,ARRAY_A);
|
||||
|
||||
foreach($input_data as $input_row) {
|
||||
$rekeyed_input[$input_row['form_id']] = $input_row;
|
||||
}
|
||||
|
||||
|
||||
if($input_data != null) {
|
||||
$form_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1'",ARRAY_A);
|
||||
|
||||
foreach($form_data as $form_field) {
|
||||
|
||||
switch($form_field['type']) {
|
||||
case 'country':
|
||||
|
||||
$delivery_region_count = $wpdb->get_var("SELECT COUNT(`regions`.`id`) FROM `".WPSC_TABLE_REGION_TAX."` AS `regions` INNER JOIN `".WPSC_TABLE_CURRENCY_LIST."` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('".$wpdb->escape( $purch_data['billing_country'])."')");
|
||||
|
||||
if(is_numeric($purch_data['billing_region']) && ($delivery_region_count > 0))
|
||||
echo " <tr><td>".__('State', 'wpsc').":</td><td>".wpsc_get_region($purch_data['billing_region'])."</td></tr>\n\r";
|
||||
|
||||
echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8')."</td></tr>\n\r";
|
||||
break;
|
||||
|
||||
case 'delivery_country':
|
||||
|
||||
if(is_numeric($purch_data['shipping_region']) && ($delivery_region_count > 0))
|
||||
echo " <tr><td>".__('State', 'wpsc').":</td><td>".wpsc_get_region($purch_data['shipping_region'])."</td></tr>\n\r";
|
||||
|
||||
echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8')."</td></tr>\n\r";
|
||||
break;
|
||||
|
||||
case 'heading':
|
||||
|
||||
if($form_field['name'] == "Hidden Fields")
|
||||
continue;
|
||||
else
|
||||
echo " <tr class='heading'><td colspan='2'><strong>".wp_kses($form_field['name'], array()).":</strong></td></tr>\n\r";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if( $form_field['name'] == "Cupcakes") {
|
||||
parse_str($rekeyed_input[$form_field['id']]['value'], $cupcakes );
|
||||
|
||||
foreach( $cupcakes as $product_id => $quantity ) {
|
||||
|
||||
$product = get_post($product_id);
|
||||
$string .= "(".$quantity.") ".$product->post_title.", ";
|
||||
|
||||
}
|
||||
$string = rtrim($string, ", ");
|
||||
echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($string), ENT_QUOTES, 'UTF-8')."</td></tr>\n\r";
|
||||
|
||||
} else {
|
||||
|
||||
if ($form_field['name']=="State" && !empty($purch_data['billing_region']) || $form_field['name']=="State" && !empty($purch_data['billing_region']))
|
||||
echo "";
|
||||
else
|
||||
echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8')."</td></tr>\n\r";
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
echo " <tr><td>".__('Name', 'wpsc').":</td><td>".$purch_data['firstname']." ".$purch_data['lastname']."</td></tr>\n\r";
|
||||
echo " <tr><td>".__('Address', 'wpsc').":</td><td>".$purch_data['address']."</td></tr>\n\r";
|
||||
echo " <tr><td>".__('Phone', 'wpsc').":</td><td>".$purch_data['phone']."</td></tr>\n\r";
|
||||
echo " <tr><td>".__('Email', 'wpsc').":</td><td>".$purch_data['email']."</td></tr>\n\r";
|
||||
}
|
||||
|
||||
if ( 2 == get_option( 'payment_method' ) ) {
|
||||
$gateway_name = '';
|
||||
$nzshpcrt_gateways = nzshpcrt_get_gateways();
|
||||
|
||||
foreach( $nzshpcrt_gateways as $gateway ) {
|
||||
if ( $purch_data['gateway'] != 'testmode' ) {
|
||||
if ( $gateway['internalname'] == $purch_data['gateway'] ) {
|
||||
$gateway_name = $gateway['name'];
|
||||
}
|
||||
} else {
|
||||
$gateway_name = __('Manual Payment', 'wpsc');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "</table>\n\r";
|
||||
|
||||
|
||||
do_action ('wpsc_packing_slip_extra_info',$purchase_id);
|
||||
|
||||
|
||||
echo "<table class='packing_slip'>";
|
||||
|
||||
echo "<tr>";
|
||||
echo " <th>".__('Quantity', 'wpsc')." </th>";
|
||||
|
||||
echo " <th>".__('Name', 'wpsc')."</th>";
|
||||
|
||||
|
||||
echo " <th>".__('Price', 'wpsc')." </th>";
|
||||
|
||||
echo " <th>".__('Shipping', 'wpsc')." </th>";
|
||||
echo '<th>' . __('Tax', 'wpsc') . '</th>';
|
||||
echo '</tr>';
|
||||
$endtotal = 0;
|
||||
$all_donations = true;
|
||||
$all_no_shipping = true;
|
||||
$file_link_list = array();
|
||||
foreach($cart_log as $cart_row) {
|
||||
$alternate = "";
|
||||
$j++;
|
||||
if(($j % 2) != 0) {
|
||||
$alternate = "class='alt'";
|
||||
}
|
||||
// product ID will be $cart_row['prodid']. need to fetch name and stuff
|
||||
|
||||
$variation_list = '';
|
||||
|
||||
if($cart_row['donation'] != 1) {
|
||||
$all_donations = false;
|
||||
}
|
||||
|
||||
if($cart_row['no_shipping'] != 1) {
|
||||
$shipping = $cart_row['pnp'] * $cart_row['quantity'];
|
||||
$total_shipping += $shipping;
|
||||
$all_no_shipping = false;
|
||||
} else {
|
||||
$shipping = 0;
|
||||
}
|
||||
|
||||
$price = $cart_row['price'] * $cart_row['quantity'];
|
||||
$gst = $price - ($price / (1+($cart_row['gst'] / 100)));
|
||||
|
||||
if($gst > 0) {
|
||||
$tax_per_item = $gst / $cart_row['quantity'];
|
||||
}
|
||||
|
||||
|
||||
echo "<tr $alternate>";
|
||||
|
||||
|
||||
echo " <td>";
|
||||
echo $cart_row['quantity'];
|
||||
echo " </td>";
|
||||
|
||||
echo " <td>";
|
||||
echo $cart_row['name'];
|
||||
echo stripslashes($variation_list);
|
||||
echo " </td>";
|
||||
|
||||
|
||||
echo " <td>";
|
||||
echo wpsc_currency_display( $price );
|
||||
echo " </td>";
|
||||
|
||||
echo " <td>";
|
||||
echo wpsc_currency_display($shipping );
|
||||
echo " </td>";
|
||||
|
||||
|
||||
|
||||
echo '<td>';
|
||||
echo wpsc_currency_display( $cart_row['tax_charged'] );
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
echo '<table class="packing-slip-totals">';
|
||||
echo '<tr><th>Base Shipping</th><td>' . wpsc_currency_display( $purch_data['base_shipping'] ) . '</td></tr>';
|
||||
echo '<tr><th>Total Shipping</th><td>' . wpsc_currency_display( $purch_data['base_shipping'] + $total_shipping ) . '</td></tr>';
|
||||
//wpec_taxes
|
||||
if($purch_data['wpec_taxes_total'] != 0.00)
|
||||
{
|
||||
echo '<tr><th>Taxes</th><td>' . wpsc_currency_display( $purch_data['wpec_taxes_total'] ) . '</td></tr>';
|
||||
}
|
||||
echo '<tr><th>Total Price</th><td>' . wpsc_currency_display( $purch_data['totalprice'] ) . '</td></tr>';
|
||||
echo '</table>';
|
||||
|
||||
echo "</div>\n\r";
|
||||
} else {
|
||||
echo "<br />".__('This users cart was empty', 'wpsc');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function wpsc_product_item_row() {
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,908 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WP eCommerce Main Admin functions
|
||||
*
|
||||
* These are the main WPSC Admin functions
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.7
|
||||
*/
|
||||
|
||||
// admin includes
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-update.page.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-items.page.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-upgrades.page.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/display-items-functions.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-functions.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/save-data.functions.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/updating-functions.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-coupons.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-includes/purchaselogs.class.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-includes/theming.class.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/ajax-and-init.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-options-settings.page.php' );
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
|
||||
if ( ( isset( $_SESSION['wpsc_activate_debug_page'] ) && ( $_SESSION['wpsc_activate_debug_page'] == true ) ) || ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && ( constant( 'WPSC_ADD_DEBUG_PAGE' ) == true ) ) )
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-debug.page.php' );
|
||||
|
||||
|
||||
//Woothemes integration
|
||||
require_once( WPSC_FILE_PATH . '/woo-integration/woo_integration.php' );
|
||||
|
||||
//settings pages include
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/general.php' );
|
||||
|
||||
if ( !get_option( 'wpsc_checkout_form_sets' ) ) {
|
||||
$form_sets = array( 'Default Checkout Forms' );
|
||||
update_option( 'wpsc_checkout_form_sets', $form_sets );
|
||||
}
|
||||
/**
|
||||
* wpsc_query_vars_product_list sets the ordering for the edit-products page list
|
||||
* @access public
|
||||
*
|
||||
* @since 3.8
|
||||
* @param $vars (array) - default query arguments
|
||||
* @return $vars (array) - modified query arguments
|
||||
*/
|
||||
function wpsc_query_vars_product_list($vars){
|
||||
global $current_screen;
|
||||
if('wpsc-product' != $current_screen->post_type) return $vars;
|
||||
|
||||
$vars['posts_per_archive_page'] = 0;
|
||||
if(is_admin() && isset($vars['orderby'])){
|
||||
$vars['orderby'] = 'date';
|
||||
$vars['order'] = 'desc';
|
||||
$vars['nopaging'] = false;
|
||||
$posts_per_page = (int)get_user_option( 'edit_wpsc_product_per_page' );
|
||||
$vars['posts_per_page'] = ( $posts_per_page )?$posts_per_page:20;
|
||||
}
|
||||
if( 'dragndrop' == get_option('wpsc_sort_by') ){
|
||||
$vars['orderby'] = 'menu_order title';
|
||||
$vars['order'] = 'desc';
|
||||
$vars['nopaging'] = true;
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* setting the screen option to between 1 and 999
|
||||
* @access public
|
||||
*
|
||||
* @since 3.8
|
||||
* @param $status
|
||||
* @param $option (string) name of option being saved
|
||||
* @param $value (string) value of option being saved
|
||||
* @return $value after changes...
|
||||
*/
|
||||
function wpsc_set_screen_option($status, $option, $value){
|
||||
if( in_array($option, array ("edit_wpsc_variation_per_page","edit_wpsc_product_per_page" )) ){
|
||||
if ( "edit_wpsc_variation_per_page" == $option ){
|
||||
global $user_ID;
|
||||
update_user_option($user_ID,'edit_wpsc-variation_per_page',$value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
add_filter('set-screen-option', 'wpsc_set_screen_option', 99, 3);
|
||||
|
||||
/**
|
||||
* When rearranging the products for drag and drop it is easiest to arrange them when they are all on the same page...
|
||||
* @access public (wp-admin)
|
||||
*
|
||||
* @since 3.8
|
||||
* @param $per_page (int) number of products per page
|
||||
* @param $post_type (string) name of current post type
|
||||
* @return $per_page after changes...
|
||||
*/
|
||||
function wpsc_drag_and_drop_ordering($per_page, $post_type){
|
||||
global $wpdb;
|
||||
if ( 'wpsc-product' == $post_type && 'dragndrop' == get_option( 'wpsc_sort_by' ) && $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE `post_type`='wpsc-product' AND `post_parent`=0" ) )
|
||||
$per_page = $count;
|
||||
return $per_page;
|
||||
}
|
||||
add_filter( 'request', 'wpsc_query_vars_product_list' );
|
||||
add_filter('edit_posts_per_page' , 'wpsc_drag_and_drop_ordering', 10, 2 );
|
||||
/**
|
||||
* Checks whether to display or hide the update wp-e-commerce link
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @since 3.8
|
||||
* @return boolean true - show link, false- hide link
|
||||
*/
|
||||
function wpsc_show_update_link() {
|
||||
global $wpdb;
|
||||
// Check if old product_list table exists
|
||||
// If it exists AND get_option wpsc_upgrade_complete is not true then return true
|
||||
$sql = 'SHOW TABLES LIKE "'.$wpdb->prefix.'wpsc_product_list"';
|
||||
$var = $wpdb->get_var( $sql );
|
||||
if ( !empty( $var ) && false == get_option( 'wpsc_hide_update' ) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* wpsc_admin_pages function, all the definitons of admin pages are stores here.
|
||||
* No parameters, returns nothing
|
||||
*
|
||||
* Fairly standard wordpress plugin API stuff for adding the admin pages, rearrange the order to rearrange the pages
|
||||
* The bits to display the options page first on first use may be buggy, but tend not to stick around long enough to be identified and fixed
|
||||
* if you find bugs, feel free to fix them.
|
||||
*
|
||||
* If the permissions are changed here, they will likewise need to be changed for the other sections of the admin that either use ajax
|
||||
* or bypass the normal download system.
|
||||
*/
|
||||
function wpsc_admin_pages() {
|
||||
|
||||
// Code to enable or disable the debug page
|
||||
if ( isset( $_GET['wpsc_activate_debug_page'] ) ) {
|
||||
if ( 'true' == $_GET['wpsc_activate_debug_page'] ) {
|
||||
$_SESSION['wpsc_activate_debug_page'] = true;
|
||||
} else if ( 'false' == $_GET['wpsc_activate_debug_page'] ) {
|
||||
$_SESSION['wpsc_activate_debug_page'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to Dashboard
|
||||
$page_hooks[] = $purchase_log_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), 'administrator', 'wpsc-sales-logs', 'wpsc_display_sales_logs' );
|
||||
|
||||
if ( wpsc_show_update_link() )
|
||||
$page_hooks[] = add_submenu_page( 'index.php', __( 'Update Store', 'wpsc' ), __( 'Store Update', 'wpsc' ), 'administrator', 'wpsc-update', 'wpsc_display_update_page' );
|
||||
|
||||
$page_hooks[] = add_submenu_page( 'index.php', __( 'Store Upgrades', 'wpsc' ), __( 'Store Upgrades', 'wpsc' ), 'administrator', 'wpsc-upgrades', 'wpsc_display_upgrades_page' );
|
||||
|
||||
// Set the base page for Products
|
||||
$products_page = 'edit.php?post_type=wpsc-product';
|
||||
|
||||
$page_hooks[] = $edit_coupons_page = add_submenu_page( $products_page , __( 'Coupons', 'wpsc' ), __( 'Coupons', 'wpsc' ), 'administrator', 'wpsc-edit-coupons', 'wpsc_display_coupons_page' );
|
||||
|
||||
// Add Settings pages
|
||||
$page_hooks[] = $edit_options_page = add_options_page( __( 'Store Settings', 'wpsc' ), __( 'Store', 'wpsc' ), 'administrator', 'wpsc-settings', 'wpsc_display_settings_page' );
|
||||
add_action( 'admin_print_scripts-' . $edit_options_page , 'wpsc_print_admin_scripts' );
|
||||
|
||||
// Debug Page
|
||||
if ( ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && ( WPSC_ADD_DEBUG_PAGE == true ) ) || ( isset( $_SESSION['wpsc_activate_debug_page'] ) && ( true == $_SESSION['wpsc_activate_debug_page'] ) ) )
|
||||
$page_hooks[] = add_options_page( __( 'Store Debug', 'wpsc' ), __( 'Store Debug', 'wpsc' ), 'administrator', 'wpsc-debug', 'wpsc_debug_page' );
|
||||
|
||||
|
||||
$header = '<p><strong>' . __( 'For More Information', 'wpsc' ) . '</strong></p>';
|
||||
|
||||
add_contextual_help( 'toplevel_page_wpsc-sales-logs', $header . __( "<a target='_blank' href='http://getshopped.org/resources/docs/building-your-store/sales/'>About the Sales Page</a>", 'wpsc' ) );
|
||||
add_contextual_help( 'toplevel_page_wpsc-edit-products', $header . __( "<a target='_blank' href='http://getshopped.org/resources/docs/building-your-store/products'>About the Products Page</a>", 'wpsc' ) );
|
||||
add_contextual_help( 'products_page_wpsc-edit-groups', $header . __( "<a target='_blank' href='http://getshopped.org/resources/docs/building-your-store/categories/'>About the Categories Page</a>", 'wpsc' ) );
|
||||
add_contextual_help( 'products_page_edit-tags', $header . __( "<a target='_blank' href='http://getshopped.org/resources/docs/building-your-store/variations/'>About the Variations Page</a>", 'wpsc' ) );
|
||||
add_contextual_help( 'settings_page_wpsc-settings', $header . __( "<a target='_blank' href='http://getshopped.org/resources/docs/store-settings/general/'>General Settings</a><br /> <a target='_blank' href='http://getshopped.org/resources/docs/store-settings/checkout/'>Checkout Options</a> <br />", 'wpsc' ) );
|
||||
add_contextual_help( 'products_page_wpsc-edit-coupons', $header . __( "<a target='_blank' href='http://getshopped.org/resources/docs/building-your-store/marketing'>Marketing Options</a><br />", 'wpsc' ) );
|
||||
|
||||
$page_hooks = apply_filters( 'wpsc_additional_pages', $page_hooks, $products_page );
|
||||
|
||||
do_action( 'wpsc_add_submenu' );
|
||||
|
||||
// Include the javascript and CSS for this page
|
||||
// This is so important that I can't even express it in one line
|
||||
|
||||
foreach ( $page_hooks as $page_hook ) {
|
||||
add_action( 'load-' . $page_hook, 'wpsc_admin_include_css_and_js_refac' );
|
||||
|
||||
switch ( $page_hook ) {
|
||||
|
||||
case $edit_options_page :
|
||||
add_action( 'load-' . $page_hook, 'wpsc_admin_include_optionspage_css_and_js' );
|
||||
break;
|
||||
|
||||
case $purchase_log_page :
|
||||
add_action( 'admin_head', 'wpsc_product_log_rss_feed' );
|
||||
break;
|
||||
|
||||
case $edit_coupons_page :
|
||||
add_action( 'load-' . $page_hook, 'wpsc_admin_include_coupon_js' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Some updating code is run from here, is as good a place as any, and better than some
|
||||
if ( ( null == get_option( 'wpsc_trackingid_subject' ) ) && ( null == get_option( 'wpsc_trackingid_message' ) ) ) {
|
||||
update_option( 'wpsc_trackingid_subject', __( 'Product Tracking Email', 'wpsc' ) );
|
||||
update_option( 'wpsc_trackingid_message', __( "Track & Trace means you may track the progress of your parcel with our online parcel tracker, just login to our website and enter the following Tracking ID to view the status of your order.\n\nTracking ID: %trackid%\n", 'wpsc' ) );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
function wpsc_product_log_rss_feed() {
|
||||
echo "<link type='application/rss+xml' href='" . get_option( 'siteurl' ) . "/wp-admin/index.php?rss=true&rss_key=key&action=purchase_log&type=rss' title='WP e-Commerce Purchase Log RSS' rel='alternate'/>";
|
||||
}
|
||||
function wpsc_admin_include_coupon_js() {
|
||||
|
||||
// Variables
|
||||
$siteurl = get_option( 'siteurl' );
|
||||
$version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
|
||||
|
||||
// Coupon CSS
|
||||
wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
|
||||
wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
|
||||
|
||||
// Coupon JS
|
||||
wp_enqueue_script( 'wp-e-commerce-admin-parameters', $siteurl . '/wp-admin/admin.php?wpsc_admin_dynamic_js=true', false, $version_identifier );
|
||||
wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
|
||||
wp_enqueue_script( 'datepicker-ui', WPSC_CORE_JS_URL . '/ui.datepicker.js', array( 'jquery-ui-core' ), $version_identifier );
|
||||
wp_enqueue_script( 'wp-e-commerce-admin_legacy', WPSC_URL . '/wpsc-admin/js/admin-legacy.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'datepicker-ui' ), $version_identifier );
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_admin_css_and_js function, includes the wpsc_admin CSS and JS
|
||||
* No parameters, returns nothing
|
||||
*/
|
||||
function wpsc_admin_include_css_and_js( ) {
|
||||
$siteurl = get_option( 'siteurl' );
|
||||
if ( is_ssl ( ) )
|
||||
$siteurl = str_replace( "http://", "https://", $siteurl );
|
||||
|
||||
wp_admin_css( 'dashboard' );
|
||||
//wp_admin_css( 'media' );
|
||||
|
||||
$version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
|
||||
wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
|
||||
wp_enqueue_script( 'wp-e-commerce-admin-parameters', $siteurl . '/wp-admin/admin.php?wpsc_admin_dynamic_js=true', false, $version_identifier );
|
||||
wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
|
||||
wp_enqueue_script( 'wp-e-commerce-legacy-ajax', WPSC_URL . '/wpsc-admin/js/ajax.js', false, $version_identifier ); // needs removing
|
||||
wp_enqueue_script( 'wp-e-commerce-variations', WPSC_URL . '/wpsc-admin/js/variations.js', array( 'jquery' ), $version_identifier );
|
||||
|
||||
wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
|
||||
wp_enqueue_style( 'wp-e-commerce-admin-dynamic', $siteurl . "/wp-admin/admin.php?wpsc_admin_dynamic_css=true", false, $version_identifier, 'all' );
|
||||
|
||||
// Prototype breaks dragging and dropping, I need it gone
|
||||
wp_deregister_script( 'prototype' );
|
||||
|
||||
// remove the old javascript and CSS, we want it no more, it smells bad
|
||||
remove_action( 'admin_head', 'wpsc_admin_css' );
|
||||
|
||||
// Localize scripts
|
||||
wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
|
||||
'unsaved_changes_detected' => __( 'Unsaved changes have been detected. Click OK to lose these changes and continue.', 'wpsc' ),
|
||||
'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
|
||||
'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};'
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_admin_include_optionspage_css_and_js function, includes the wpsc_admin CSS and JS for the specific options page
|
||||
* No parameters, returns nothing
|
||||
*/
|
||||
function wpsc_admin_include_optionspage_css_and_js() {
|
||||
$version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
|
||||
wp_enqueue_script( 'wp-e-commerce-js-ajax', WPSC_URL . '/wpsc-core/js/ajax.js', false, $version_identifier );
|
||||
wp_enqueue_script( 'wp-e-commerce-js-ui-tabs', WPSC_URL . '/wpsc-admin/js/jquery-ui.js', false, $version_identifier );
|
||||
wp_enqueue_script( 'wp-e-commerce-js-dimensions', WPSC_URL . '/wpsc-admin/js/dimensions.js', false, $version_identifier );
|
||||
wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
|
||||
wp_enqueue_style( 'wp-e-commerce-ui-tabs', WPSC_URL . '/wpsc-admin/css/jquery.ui.tabs.css', false, $version_identifier, 'all' );
|
||||
}
|
||||
|
||||
function wpsc_meta_boxes() {
|
||||
global $post;
|
||||
$pagename = 'wpsc-product';
|
||||
remove_meta_box( 'wpsc-variationdiv', 'wpsc-product', 'core' );
|
||||
|
||||
//if a variation page do not show these metaboxes
|
||||
if ( is_object( $post ) && $post->post_parent == 0 ) {
|
||||
add_meta_box( 'wpsc_product_variation_forms', __('Variations', 'wpsc'), 'wpsc_product_variation_forms', $pagename, 'normal', 'high' );
|
||||
add_meta_box( 'wpsc_product_external_link_forms', __('Off Site Product link', 'wpsc'), 'wpsc_product_external_link_forms', $pagename, 'normal', 'high' );
|
||||
} else if( is_object( $post ) && $post->post_status == "inherit" ) {
|
||||
remove_meta_box( 'tagsdiv-product_tag', 'wpsc-product', 'core' );
|
||||
remove_meta_box( 'wpsc_product_external_link_forms', 'wpsc-product', 'core' );
|
||||
remove_meta_box( 'wpsc_product_categorydiv', 'wpsc-product', 'core' );
|
||||
}
|
||||
|
||||
add_meta_box( 'wpsc_price_control_forms', __('Price Control', 'wpsc'), 'wpsc_price_control_forms', $pagename, 'side', 'low' );
|
||||
add_meta_box( 'wpsc_stock_control_forms', __('Stock Control', 'wpsc'), 'wpsc_stock_control_forms', $pagename, 'side', 'low' );
|
||||
add_meta_box( 'wpsc_product_taxes_forms', __('Taxes', 'wpsc'), 'wpsc_product_taxes_forms', $pagename, 'side', 'low' );
|
||||
add_meta_box( 'wpsc_additional_desc', __('Additional Description', 'wpsc'), 'wpsc_additional_desc', $pagename, 'normal', 'high' );
|
||||
add_meta_box( 'wpsc_product_download_forms', __('Product Download', 'wpsc'), 'wpsc_product_download_forms', $pagename, 'normal', 'high' );
|
||||
add_meta_box( 'wpsc_product_image_forms', __('Product Images', 'wpsc'), 'wpsc_product_image_forms', $pagename, 'normal', 'high' );
|
||||
add_meta_box( 'wpsc_product_shipping_forms', __('Shipping', 'wpsc'), 'wpsc_product_shipping_forms', $pagename, 'normal', 'high' );
|
||||
add_meta_box( 'wpsc_product_advanced_forms', __('Advanced Settings', 'wpsc'), 'wpsc_product_advanced_forms', $pagename, 'normal', 'high' );
|
||||
|
||||
}
|
||||
|
||||
add_action( 'admin_footer', 'wpsc_meta_boxes' );
|
||||
|
||||
add_action( 'admin_head', 'wpsc_admin_include_css_and_js' );
|
||||
add_action( 'admin_head', 'wpsc_admin_include_css_and_js_refac' );
|
||||
add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
|
||||
function wpsc_admin_include_css_and_js_refac( $pagehook ) {
|
||||
|
||||
global $post_type, $current_screen;
|
||||
$siteurl = get_option( 'siteurl' );
|
||||
if ( is_ssl ( ) )
|
||||
$siteurl = str_replace( "http://", "https://", $siteurl );
|
||||
|
||||
wp_admin_css( 'dashboard' );
|
||||
|
||||
if($current_screen->id == 'dashboard_page_wpsc-sales-logs'){
|
||||
// jQuery
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'jquery-ui-draggable' );
|
||||
wp_enqueue_script( 'jquery-ui-droppable' );
|
||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
||||
|
||||
// Metaboxes
|
||||
wp_enqueue_script( 'common' );
|
||||
wp_enqueue_script( 'wp-lists' );
|
||||
wp_enqueue_script( 'postbox' );
|
||||
}
|
||||
|
||||
$version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
|
||||
$pages = array( 'index.php', 'options-general.php', 'edit.php', 'post.php', 'post-new.php' );
|
||||
|
||||
if ( ( in_array( $pagehook, $pages ) && $post_type == 'wpsc-product' ) || $current_screen->id == 'edit-wpsc_product_category' || $current_screen->id == 'dashboard_page_wpsc-sales-logs' || $current_screen->id == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' ) {
|
||||
wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
|
||||
wp_enqueue_script( 'wp-e-commerce-admin-parameters', $siteurl . '/wp-admin/admin.php?wpsc_admin_dynamic_js=true', false, $version_identifier );
|
||||
wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
|
||||
wp_enqueue_script( 'wp-e-commerce-legacy-ajax', WPSC_URL . '/wpsc-admin/js/ajax.js', false, $version_identifier ); // needs removing
|
||||
wp_enqueue_script( 'wp-e-commerce-variations', WPSC_URL . '/wpsc-admin/js/variations.js', array( 'jquery' ), $version_identifier );
|
||||
wp_enqueue_script( 'inline-edit-post' );
|
||||
wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
|
||||
wp_enqueue_style( 'wp-e-commerce-admin-dynamic', $siteurl . "/wp-admin/admin.php?wpsc_admin_dynamic_css=true", false, $version_identifier, 'all' );
|
||||
// Localize scripts
|
||||
wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
|
||||
'unsaved_changes_detected' => __( 'Unsaved changes have been detected. Click OK to lose these changes and continue.', 'wpsc' ),
|
||||
'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
|
||||
'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};'
|
||||
) );
|
||||
}
|
||||
if ( 'dashboard_page_wpsc-upgrades' == $pagehook || 'dashboard_page_wpsc-update' == $pagehook )
|
||||
wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
|
||||
wp_deregister_script( 'prototype' );
|
||||
|
||||
// remove the old javascript and CSS, we want it no more, it smells bad
|
||||
remove_action( 'admin_head', 'wpsc_admin_css' );
|
||||
}
|
||||
|
||||
function wpsc_admin_dynamic_js() {
|
||||
header( 'Content-Type: text/javascript' );
|
||||
header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
|
||||
header( 'Cache-Control: public, must-revalidate, max-age=86400' );
|
||||
header( 'Pragma: public' );
|
||||
|
||||
$siteurl = get_option( 'siteurl' );
|
||||
$hidden_boxes = get_option( 'wpsc_hidden_box' );
|
||||
|
||||
$form_types1 = get_option( 'wpsc_checkout_form_fields' );
|
||||
$unique_names1 = get_option( 'wpsc_checkout_unique_names' );
|
||||
|
||||
$form_types = '';
|
||||
foreach ( (array)$form_types1 as $form_type ) {
|
||||
$form_types .= "<option value='" . $form_type . "'>" . $form_type . "</option>";
|
||||
}
|
||||
|
||||
$unique_names = "<option value='-1'>" . __('Select a Unique Name', 'wpsc') . "</option>";
|
||||
foreach ( (array)$unique_names1 as $unique_name ) {
|
||||
$unique_names.= "<option value='" . $unique_name . "'>" . $unique_name . "</option>";
|
||||
}
|
||||
|
||||
$hidden_boxes = implode( ',', (array)$hidden_boxes );
|
||||
|
||||
echo "var base_url = '" . $siteurl . "';\n\r";
|
||||
echo "var WPSC_URL = '" . WPSC_URL . "';\n\r";
|
||||
echo "var WPSC_IMAGE_URL = '" . WPSC_IMAGE_URL . "';\n\r";
|
||||
echo "var WPSC_DIR_NAME = '" . WPSC_DIR_NAME . "';\n\r";
|
||||
echo "var WPSC_IMAGE_URL = '" . WPSC_IMAGE_URL . "';\n\r";
|
||||
|
||||
// LightBox Configuration start
|
||||
echo "var fileLoadingImage = '" . WPSC_CORE_IMAGES_URL . "/loading.gif';\n\r";
|
||||
echo "var fileBottomNavCloseImage = '" . WPSC_CORE_IMAGES_URL . "/closelabel.gif';\n\r";
|
||||
echo "var fileThickboxLoadingImage = '" . WPSC_CORE_IMAGES_URL . "/loadingAnimation.gif';\n\r";
|
||||
|
||||
echo "var resizeSpeed = 9;\n\r";
|
||||
|
||||
echo "var borderSize = 10;\n\r";
|
||||
|
||||
echo "var hidden_boxes = '" . $hidden_boxes . "';\n\r";
|
||||
echo "var IS_WP27 = '" . IS_WP27 . "';\n\r";
|
||||
echo "var TXT_WPSC_DELETE = '" . __( 'Delete', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_TEXT = '" . __( 'Text', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_EMAIL = '" . __( 'Email', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_COUNTRY = '" . __( 'Country', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_TEXTAREA = '" . __( 'Textarea', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_HEADING = '" . __( 'Heading', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_COUPON = '" . __( 'Coupon', 'wpsc' ) . "';\n\r";
|
||||
|
||||
echo "var HTML_FORM_FIELD_TYPES =\" " . $form_types . "; \" \n\r";
|
||||
echo "var HTML_FORM_FIELD_UNIQUE_NAMES = \" " . $unique_names . "; \" \n\r";
|
||||
|
||||
echo "var TXT_WPSC_LABEL = '" . __( 'Label', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_LABEL_DESC = '" . __( 'Label Description', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_ITEM_NUMBER = '" . __( 'Item Number', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_LIFE_NUMBER = '" . __( 'Life Number', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_PRODUCT_CODE = '" . __( 'Product Code', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_PDF = '" . __( 'PDF', 'wpsc' ) . "';\n\r";
|
||||
|
||||
echo "var TXT_WPSC_AND_ABOVE = '" . __( ' and above', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_IF_PRICE_IS = '" . __( 'If price is ', 'wpsc' ) . "';\n\r";
|
||||
echo "var TXT_WPSC_IF_WEIGHT_IS = '" . __( 'If weight is ', 'wpsc' ) . "';\n\r";
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( isset( $_GET['wpsc_admin_dynamic_js'] ) && ( $_GET['wpsc_admin_dynamic_js'] == 'true' ) ) {
|
||||
add_action( "admin_init", 'wpsc_admin_dynamic_js' );
|
||||
}
|
||||
|
||||
function wpsc_admin_dynamic_css() {
|
||||
header( 'Content-Type: text/css' );
|
||||
header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
|
||||
header( 'Cache-Control: public, must-revalidate, max-age=86400' );
|
||||
header( 'Pragma: public' );
|
||||
$flash = 0;
|
||||
$flash = apply_filters( 'flash_uploader', $flash );
|
||||
|
||||
if ( $flash = 1 ) {
|
||||
?>
|
||||
div.flash-image-uploader {
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.browser-image-uploader {
|
||||
display: none;
|
||||
}
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
div.flash-image-uploader {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.browser-image-uploader {
|
||||
display: block;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( isset( $_GET['wpsc_admin_dynamic_css'] ) && ( $_GET['wpsc_admin_dynamic_css'] == 'true' ) ) {
|
||||
add_action( "admin_init", 'wpsc_admin_dynamic_css' );
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', 'wpsc_admin_pages' );
|
||||
|
||||
|
||||
function wpsc_admin_latest_activity() {
|
||||
global $wpdb;
|
||||
$totalOrders = $wpdb->get_var( "SELECT COUNT(*) FROM `" . WPSC_TABLE_PURCHASE_LOGS . "`" );
|
||||
|
||||
/*
|
||||
* This is the right hand side for the past 30 days revenue on the wp dashboard
|
||||
*/
|
||||
echo "<div id='leftDashboard'>";
|
||||
echo "<strong class='dashboardHeading'>" . __( 'Current Month', 'wpsc' ) . "</strong><br />";
|
||||
echo "<p class='dashboardWidgetSpecial'>";
|
||||
// calculates total amount of orders for the month
|
||||
$year = date( "Y" );
|
||||
$month = date( "m" );
|
||||
$start_timestamp = mktime( 0, 0, 0, $month, 1, $year );
|
||||
$end_timestamp = mktime( 0, 0, 0, ( $month + 1 ), 0, $year );
|
||||
$sql = "SELECT COUNT(*) FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date` BETWEEN '$start_timestamp' AND '$end_timestamp' AND `processed` IN (2,3,4) ORDER BY `date` DESC";
|
||||
$currentMonthOrders = $wpdb->get_var( $sql );
|
||||
|
||||
//calculates amount of money made for the month
|
||||
$currentMonthsSales = wpsc_currency_display( admin_display_total_price( $start_timestamp, $end_timestamp ) );
|
||||
echo $currentMonthsSales;
|
||||
echo "<span class='dashboardWidget'>" . _x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
|
||||
echo "</p>";
|
||||
echo "<p class='dashboardWidgetSpecial'>";
|
||||
echo "<span class='pricedisplay'>";
|
||||
echo $currentMonthOrders;
|
||||
echo "</span>";
|
||||
echo "<span class='dashboardWidget'>" . _n( 'Order', 'Orders', $currentMonthOrders, 'wpsc' ) . "</span>";
|
||||
echo "</p>";
|
||||
echo "<p class='dashboardWidgetSpecial'>";
|
||||
//calculates average sales amount per order for the month
|
||||
if ( $currentMonthOrders > 0 ) {
|
||||
$monthsAverage = ( (int)admin_display_total_price( $start_timestamp, $end_timestamp ) / (int)$currentMonthOrders );
|
||||
echo wpsc_currency_display( $monthsAverage );
|
||||
}
|
||||
//echo "</span>";
|
||||
echo "<span class='dashboardWidget'>" . __( 'Avg Order', 'wpsc' ) . "</span>";
|
||||
echo "</p>";
|
||||
echo "</div>";
|
||||
/*
|
||||
* This is the left side for the total life time revenue on the wp dashboard
|
||||
*/
|
||||
|
||||
echo "<div id='rightDashboard' >";
|
||||
echo "<strong class='dashboardHeading'>" . __( 'Total Income', 'wpsc' ) . "</strong><br />";
|
||||
|
||||
echo "<p class='dashboardWidgetSpecial'>";
|
||||
echo wpsc_currency_display( admin_display_total_price() );
|
||||
echo "<span class='dashboardWidget'>" . _x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
|
||||
echo "</p>";
|
||||
echo "<p class='dashboardWidgetSpecial'>";
|
||||
echo "<span class='pricedisplay'>";
|
||||
echo $totalOrders;
|
||||
echo "</span>";
|
||||
echo "<span class='dashboardWidget'>" . _n( 'Order', 'Orders', $totalOrders, 'wpsc' ) . "</span>";
|
||||
echo "</p>";
|
||||
echo "<p class='dashboardWidgetSpecial'>";
|
||||
//calculates average sales amount per order for the month
|
||||
if ( ( admin_display_total_price() > 0 ) && ( $totalOrders > 0 ) ) {
|
||||
$totalAverage = ( (int)admin_display_total_price() / (int)$totalOrders );
|
||||
} else {
|
||||
$totalAverage = 0;
|
||||
}
|
||||
echo wpsc_currency_display( $totalAverage );
|
||||
//echo "</span>";
|
||||
echo "<span class='dashboardWidget'>" . __( 'Avg Order', 'wpsc' ) . "</span>";
|
||||
echo "</p>";
|
||||
echo "</div>";
|
||||
echo "<div style='clear:both'></div>";
|
||||
}
|
||||
|
||||
add_action( 'wpsc_admin_pre_activity', 'wpsc_admin_latest_activity' );
|
||||
|
||||
|
||||
/*
|
||||
* Dashboard Widget Setup
|
||||
* Adds the dashboard widgets if the user is an admin
|
||||
* Since 3.6
|
||||
*/
|
||||
|
||||
function wpsc_dashboard_widget_setup() {
|
||||
if ( is_admin() && current_user_can( 'manage_options' ) ) {
|
||||
$version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
|
||||
// Enqueue the styles and scripts necessary
|
||||
wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
|
||||
wp_enqueue_script( 'datepicker-ui', WPSC_URL . "/wpsc-core/js/ui.datepicker.js", array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier );
|
||||
// Add the dashboard widgets
|
||||
wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'Getshopped News' , 'wpsc' ), 'wpsc_dashboard_news' );
|
||||
wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wpsc' ), 'wpsc_dashboard_widget' );
|
||||
wp_add_dashboard_widget( 'wpsc_quarterly_dashboard_widget', __( 'Sales by Quarter', 'wpsc' ), 'wpsc_quarterly_dashboard_widget' );
|
||||
wp_add_dashboard_widget( 'wpsc_dashboard_4months_widget', __( 'Sales by Month', 'wpsc' ), 'wpsc_dashboard_4months_widget' );
|
||||
|
||||
// Sort the Dashboard widgets so ours it at the top
|
||||
global $wp_meta_boxes;
|
||||
$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
|
||||
// Backup and delete our new dashbaord widget from the end of the array
|
||||
$wpsc_widget_backup = array( 'wpsc_dashboard_news' => $normal_dashboard['wpsc_dashboard_news'] );
|
||||
$wpsc_widget_backup += array( 'wpsc_dashboard_widget' => $normal_dashboard['wpsc_dashboard_widget'] );
|
||||
$wpsc_widget_backup += array( 'wpsc_quarterly_dashboard_widget' => $normal_dashboard['wpsc_quarterly_dashboard_widget'] );
|
||||
$wpsc_widget_backup += array( 'wpsc_dashboard_4months_widget' => $normal_dashboard['wpsc_dashboard_4months_widget'] );
|
||||
|
||||
unset( $normal_dashboard['wpsc_dashboard_news'] );
|
||||
unset( $normal_dashboard['wpsc_dashboard_widget'] );
|
||||
unset( $normal_dashboard['wpsc_quarterly_dashboard_widget'] );
|
||||
unset( $normal_dashboard['wpsc_dashboard_4months_widget'] );
|
||||
|
||||
// Merge the two arrays together so our widget is at the beginning
|
||||
|
||||
$sorted_dashboard = array_merge( $wpsc_widget_backup, $normal_dashboard );
|
||||
|
||||
// Save the sorted array back into the original metaboxes
|
||||
|
||||
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Registers the widgets on the WordPress Dashboard
|
||||
*/
|
||||
|
||||
add_action( 'wp_dashboard_setup', 'wpsc_dashboard_widget_setup' );
|
||||
|
||||
function wpsc_dashboard_news() {
|
||||
$rss = fetch_feed( 'http://getshopped.org/category/wp-e-commerce-plugin/' );
|
||||
$args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items'=>3 );
|
||||
wp_widget_rss_output( $rss, $args );
|
||||
|
||||
}
|
||||
|
||||
function wpsc_get_quarterly_summary() {
|
||||
(int)$firstquarter = get_option( 'wpsc_first_quart' );
|
||||
(int)$secondquarter = get_option( 'wpsc_second_quart' );
|
||||
(int)$thirdquarter = get_option( 'wpsc_third_quart' );
|
||||
(int)$fourthquarter = get_option( 'wpsc_fourth_quart' );
|
||||
(int)$finalquarter = get_option( 'wpsc_final_quart' );
|
||||
|
||||
$results[] = admin_display_total_price( $thirdquarter + 1, $fourthquarter );
|
||||
$results[] = admin_display_total_price( $secondquarter + 1, $thirdquarter );
|
||||
$results[] = admin_display_total_price( $firstquarter + 1, $secondquarter );
|
||||
$results[] = admin_display_total_price( $finalquarter, $firstquarter );
|
||||
return $results;
|
||||
}
|
||||
|
||||
function wpsc_quarterly_dashboard_widget() {
|
||||
if ( get_option( 'wpsc_business_year_start' ) == false ) {
|
||||
?>
|
||||
<form action='' method='post'>
|
||||
<label for='date_start'><?php _e( 'Financial Year End' , 'wpsc' ); ?>: </label>
|
||||
<input id='date_start' type='text' class='pickdate' size='11' value='<?php echo get_option( 'wpsc_last_date' ); ?>' name='add_start' />
|
||||
<!--<select name='add_start[day]'>
|
||||
<?php
|
||||
for ( $i = 1; $i <= 31; ++$i ) {
|
||||
$selected = '';
|
||||
if ( $i == date( "d" ) ) {
|
||||
$selected = "selected='selected'";
|
||||
}
|
||||
echo "<option $selected value='$i'>$i</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<select name='add_start[month]'>
|
||||
<?php
|
||||
for ( $i = 1; $i <= 12; ++$i ) {
|
||||
$selected = '';
|
||||
if ( $i == (int)date( "m" ) ) {
|
||||
$selected = "selected='selected'";
|
||||
}
|
||||
echo "<option $selected value='$i'>" . date( "M", mktime( 0, 0, 0, $i, 1, date( "Y" ) ) ) . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<select name='add_start[year]'>
|
||||
<?php
|
||||
for ( $i = date( "Y" ); $i <= ( date( "Y" ) + 12 ); ++$i ) {
|
||||
$selected = '';
|
||||
if ( $i == date( "Y" ) ) {
|
||||
$selected = "selected='true'";
|
||||
}
|
||||
echo "<option $selected value='$i'>" . $i . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>-->
|
||||
<input type='hidden' name='wpsc_admin_action' value='wpsc_quarterly' />
|
||||
<input type='submit' class='button primary' value='Submit' name='wpsc_submit' />
|
||||
</form>
|
||||
<?php
|
||||
if ( get_option( 'wpsc_first_quart' ) != '' ) {
|
||||
$firstquarter = get_option( 'wpsc_first_quart' );
|
||||
$secondquarter = get_option( 'wpsc_second_quart' );
|
||||
$thirdquarter = get_option( 'wpsc_third_quart' );
|
||||
$fourthquarter = get_option( 'wpsc_fourth_quart' );
|
||||
$finalquarter = get_option( 'wpsc_final_quart' );
|
||||
$revenue = wpsc_get_quarterly_summary();
|
||||
$currsymbol = wpsc_get_currency_symbol();
|
||||
foreach ( $revenue as $rev ) {
|
||||
if ( $rev == '' ) {
|
||||
$totals[] = '0.00';
|
||||
} else {
|
||||
$totals[] = $rev;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div id='box'>
|
||||
<p class='atglance'>
|
||||
<span class='wpsc_quart_left'><?php _e( 'At a Glance' , 'wpsc' ); ?></span>
|
||||
<span class='wpsc_quart_right'><?php _e( 'Revenue' , 'wpsc' ); ?></span>
|
||||
</p>
|
||||
<div style='clear:both'></div>
|
||||
<p class='quarterly'>
|
||||
<span class='wpsc_quart_left'><strong>01</strong> (<?php echo date( 'M Y', $thirdquarter ) . ' - ' . date( 'M Y', $fourthquarter ); ?>)</span>
|
||||
<span class='wpsc_quart_right'><?php echo $currsymbol . ' ' . $totals[0]; ?></span></p>
|
||||
<p class='quarterly'>
|
||||
<span class='wpsc_quart_left'><strong>02</strong> (<?php echo date( 'M Y', $secondquarter ) . ' - ' . date( 'M Y', $thirdquarter ); ?>)</span>
|
||||
<span class='wpsc_quart_right'><?php echo $currsymbol . ' ' . $totals[1]; ?></span></p>
|
||||
<p class='quarterly'>
|
||||
<span class='wpsc_quart_left'><strong>03</strong> (<?php echo date( 'M Y', $firstquarter ) . ' - ' . date( 'M Y', $secondquarter ); ?>)</span>
|
||||
<span class='wpsc_quart_right'><?php echo $currsymbol . ' ' . $totals[2]; ?></span></p>
|
||||
<p class='quarterly'>
|
||||
<span class='wpsc_quart_left'><strong>04</strong> (<?php echo date( 'M Y', $finalquarter ) . ' - ' . date( 'M Y', $firstquarter ); ?>)</span>
|
||||
<span class='wpsc_quart_right'><?php echo $currsymbol . ' ' . $totals[3]; ?></span>
|
||||
</p>
|
||||
<div style='clear:both'></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function wpsc_dashboard_widget() {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
do_action( 'wpsc_admin_pre_activity' );
|
||||
do_action( 'wpsc_admin_post_activity' );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* END - Dashboard Widget for 2.7
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Dashboard Widget Last Four Month Sales.
|
||||
*/
|
||||
|
||||
function wpsc_dashboard_4months_widget() {
|
||||
global $wpdb;
|
||||
|
||||
$this_year = date( "Y" ); //get current year and month
|
||||
$this_month = date( "n" );
|
||||
|
||||
$months[] = mktime( 0, 0, 0, $this_month - 3, 1, $this_year ); //generate unix time stamps fo 4 last months
|
||||
$months[] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
|
||||
$months[] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
|
||||
$months[] = mktime( 0, 0, 0, $this_month, 1, $this_year );
|
||||
|
||||
$products = $wpdb->get_results( "SELECT `cart`.`prodid`,
|
||||
`cart`.`name`
|
||||
FROM `" . WPSC_TABLE_CART_CONTENTS . "` AS `cart`
|
||||
INNER JOIN `" . WPSC_TABLE_PURCHASE_LOGS . "` AS `logs`
|
||||
ON `cart`.`purchaseid` = `logs`.`id`
|
||||
WHERE `logs`.`processed` >= 2
|
||||
AND `logs`.`date` >= " . $months[0] . "
|
||||
GROUP BY `cart`.`prodid`
|
||||
ORDER BY SUM(`cart`.`price` * `cart`.`quantity`) DESC
|
||||
LIMIT 4", ARRAY_A ); //get 4 products with top income in 4 last months.
|
||||
|
||||
$timeranges[0]["start"] = mktime( 0, 0, 0, $this_month - 3, 1, $this_year ); //make array of time ranges
|
||||
$timeranges[0]["end"] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
|
||||
$timeranges[1]["start"] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
|
||||
$timeranges[1]["end"] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
|
||||
$timeranges[2]["start"] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
|
||||
$timeranges[2]["end"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
|
||||
$timeranges[3]["start"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
|
||||
$timeranges[3]["end"] = mktime();
|
||||
|
||||
$prod_data = array( );
|
||||
foreach ( (array)$products as $product ) { //run through products and get each product income amounts and name
|
||||
$sale_totals = array( );
|
||||
foreach ( $timeranges as $timerange ) { //run through time ranges of product, and get its income over each time range
|
||||
$prodsql = "SELECT
|
||||
SUM(`cart`.`price` * `cart`.`quantity`) AS sum
|
||||
FROM `" . WPSC_TABLE_CART_CONTENTS . "` AS `cart`
|
||||
INNER JOIN `" . WPSC_TABLE_PURCHASE_LOGS . "` AS `logs`
|
||||
ON `cart`.`purchaseid` = `logs`.`id`
|
||||
WHERE `logs`.`processed` >= 2
|
||||
AND `logs`.`date` >= " . $timerange["start"] . "
|
||||
AND `logs`.`date` < " . $timerange["end"] . "
|
||||
AND `cart`.`prodid` = " . $product['prodid'] . "
|
||||
GROUP BY `cart`.`prodid`"; //get the amount of income that current product has generaterd over current time range
|
||||
$sale_totals[] = $wpdb->get_var( $prodsql ); //push amount to array
|
||||
}
|
||||
$prod_data[] = array(
|
||||
'sale_totals' => $sale_totals,
|
||||
'product_name' => $product['name'] ); //result: array of 2: $prod_data[0] = array(income)
|
||||
$sums = array( ); //reset array //$prod_data[1] = product name
|
||||
}
|
||||
|
||||
$tablerow = 1;
|
||||
ob_start();
|
||||
?>
|
||||
<div style="padding-bottom:15px; "><?php _e('Last four months of sales on a per product basis:', 'wpsc'); ?></div>
|
||||
<table style="width:100%" border="0" cellspacing="0">
|
||||
<tr style="font-style:italic; color:#666;" height="20">
|
||||
<td colspan="2" style=" font-family:\'Times New Roman\', Times, serif; font-size:15px; border-bottom:solid 1px #000;"><?php _e('At a Glance', 'wpsc'); ?></td>
|
||||
<?php foreach ( $months as $mnth ): ?>
|
||||
<td align="center" style=" font-family:\'Times New Roman\'; font-size:15px; border-bottom:solid 1px #000;"><?php echo date( "M", $mnth ); ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php foreach ( (array)$prod_data as $sales_data ): ?>
|
||||
<tr height="20">
|
||||
<td width="20" style="font-weight:bold; color:#008080; border-bottom:solid 1px #000;"><?php echo $tablerow; ?></td>
|
||||
<td style="border-bottom:solid 1px #000;width:60px"><?php echo $sales_data['product_name']; ?></td>
|
||||
<?php foreach ( $sales_data['sale_totals'] as $amount ): ?>
|
||||
<td align="center" style="border-bottom:solid 1px #000;"><?php echo wpsc_currency_display($amount); ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php
|
||||
$tablerow++;
|
||||
endforeach; ?>
|
||||
</table>
|
||||
<?php
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
|
||||
//Modification to allow for multiple column layout
|
||||
|
||||
function wpec_two_columns( $columns, $screen ) {
|
||||
if ( $screen == 'toplevel_page_wpsc-edit-products' )
|
||||
$columns['toplevel_page_wpsc-edit-products'] = 2;
|
||||
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'screen_layout_columns', 'wpec_two_columns', 10, 2 );
|
||||
|
||||
function wpsc_fav_action( $actions ) {
|
||||
$actions['post-new.php?post_type=wpsc-product'] = array( 'New Product', 'manage_options' );
|
||||
return $actions;
|
||||
}
|
||||
add_filter( 'favorite_actions', 'wpsc_fav_action' );
|
||||
|
||||
function wpsc_print_admin_scripts() {
|
||||
wp_enqueue_script( 'wp-e-commerce-dynamic', get_bloginfo( 'url' ) . "/index.php?wpsc_user_dynamic_js=true" );
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_update_permalinks update the product pages permalinks when WordPress permalinks are changed
|
||||
*
|
||||
* @public
|
||||
*
|
||||
* @3.8
|
||||
* @returns nothing
|
||||
*/
|
||||
function wpsc_update_permalinks( $return = '' ) {
|
||||
wpsc_update_page_urls( true );
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_ajax_ie_save save changes made using inline edit
|
||||
*
|
||||
* @public
|
||||
*
|
||||
* @3.8
|
||||
* @returns nothing
|
||||
*/
|
||||
function wpsc_ajax_ie_save() {
|
||||
|
||||
$product_post_type = get_post_type_object( 'wpsc-product' );
|
||||
|
||||
if ( !current_user_can( $product_post_type->cap->edit_posts ) ) {
|
||||
echo '({"error":"' . __( 'Error: you don\'t have required permissions to edit this product', 'wpsc' ) . '", "id": "'. $_POST['id'] .'"})';
|
||||
die();
|
||||
}
|
||||
|
||||
$product = array(
|
||||
'ID' => $_POST['id'],
|
||||
'post_title' => $_POST['title']
|
||||
);
|
||||
|
||||
$id = wp_update_post( $product );
|
||||
if ( $id > 0 ) {
|
||||
//need parent meta to know which weight unit we are using
|
||||
$post = get_post( $id );
|
||||
$parent_meta = get_product_meta($post->post_parent, 'product_metadata', true );
|
||||
$product_meta = get_product_meta( $product['ID'], 'product_metadata', true );
|
||||
if ( is_numeric( $_POST['weight'] ) || empty( $_POST['weight'] ) ){
|
||||
$product_meta['weight'] = wpsc_convert_weight($_POST['weight'], $parent_meta['weight_unit'], 'pound', true);
|
||||
$product_meta['weight_unit'] = $parent_meta['weight_unit'];
|
||||
}
|
||||
|
||||
update_product_meta( $product['ID'], 'product_metadata', $product_meta );
|
||||
update_product_meta( $product['ID'], 'price', (float)$_POST['price'] );
|
||||
update_product_meta( $product['ID'], 'special_price', (float)$_POST['special_price'] );
|
||||
update_product_meta( $product['ID'], 'sku', $_POST['sku'] );
|
||||
if ( !is_numeric($_POST['stock']) )
|
||||
update_product_meta( $product['ID'], 'stock', '' );
|
||||
else
|
||||
update_product_meta( $product['ID'], 'stock', absint( $_POST['stock'] ) );
|
||||
|
||||
$post = get_post( $id );
|
||||
$meta = get_product_meta( $id, 'product_metadata', true );
|
||||
$price = get_product_meta( $id, 'price', true );
|
||||
$special_price = get_product_meta( $id, 'special_price', true );
|
||||
$sku = get_product_meta( $id, 'sku', true );
|
||||
$sku = ( $sku )?$sku:__('N/A', 'wpsc');
|
||||
$stock = get_product_meta( $id, 'stock', true );
|
||||
$stock = ( $stock === '' )?__('N/A', 'wpsc'):$stock;
|
||||
$results = array( 'id' => $id, 'title' => $post->post_title, 'weight' => wpsc_convert_weight($meta['weight'], 'pound', $parent_meta['weight_unit']), 'price' => wpsc_currency_display( $price ), 'special_price' => wpsc_currency_display( $special_price ), 'sku' => $sku, 'stock' => $stock );
|
||||
echo '(' . json_encode( $results ) . ')';
|
||||
die();
|
||||
} else {
|
||||
echo '({"error":"' . __( 'Error updating product', 'wpsc' ) . '", "id": "'. $_POST['id'] .'"})';
|
||||
}
|
||||
die();
|
||||
}
|
||||
|
||||
function wpsc_add_meta_boxes(){
|
||||
add_meta_box( 'dashboard_right_now', __('Current Month', 'wpsc'), 'wpsc_right_now', 'dashboard_page_wpsc-sales-logs', 'top' );
|
||||
}
|
||||
|
||||
function wpsc_check_permalink_notice(){
|
||||
|
||||
?>
|
||||
<div id="notice" class="error fade"><p>
|
||||
<?php printf( __( 'Due to a problem in WordPress Permalinks and Custom Post Types, WP e-Commerce encourages you to refresh your permalinks a second time. (for a more geeky explanation visit <a href="%s">trac</a>)' , 'wpsc' ), 'http://core.trac.wordpress.org/ticket/16736' ); ?>
|
||||
</p></div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
add_action( 'permalink_structure_changed' , 'wpsc_check_permalink_notice' );
|
||||
add_action( 'permalink_structure_changed' , 'wpsc_update_permalinks' );
|
||||
/* add_action( 'get_sample_permalink_html' , 'wpsc_update_permalinks' ); // this just seems unnecessary and produces PHP notices */
|
||||
add_action( 'wp_ajax_category_sort_order', 'wpsc_ajax_set_category_order' );
|
||||
add_action( 'wp_ajax_wpsc_ie_save', 'wpsc_ajax_ie_save' );
|
||||
add_action('in_admin_header', 'wpsc_add_meta_boxes');
|
||||
?>
|
||||
@ -1,152 +0,0 @@
|
||||
/* Caution! Ensure accessibility in print and other media types... */
|
||||
@media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */
|
||||
.ui-tabs-hide {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide useless elements in print layouts... */
|
||||
@media print {
|
||||
.ui-tabs-nav {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Skin */
|
||||
#slider {
|
||||
border-color:#EBEBEB rgb(204, 204, 204) rgb(204, 204, 204) rgb(235, 235, 235);
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
margin:0pt 15% 0pt 15px;
|
||||
padding:2px;
|
||||
}
|
||||
#tabs{
|
||||
display: block;
|
||||
background:#EAF3FA none repeat scroll 0%;
|
||||
font-size:14px;
|
||||
margin:0pt 0pt 10px;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.ui-tabs-nav {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 0 0 4px;
|
||||
}
|
||||
.ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */
|
||||
display: block;
|
||||
clear: both;
|
||||
content: " ";
|
||||
}
|
||||
.ui-tabs-nav li {
|
||||
float: left;
|
||||
padding:8px 5px;
|
||||
min-width: 84px; /* be nice to Opera */
|
||||
margin: 2px 2px 0px 1px !important;
|
||||
text-decoration: none;
|
||||
list-style: none;
|
||||
}
|
||||
.ui-tabs-nav a, .ui-tabs-nav a span {
|
||||
display: block;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.ui-tabs-nav a {
|
||||
margin: 1px 0 0; /* position: relative makes opacity fail for disabled tab in IE */
|
||||
padding-left: 0;
|
||||
color: #27537a;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
white-space: nowrap; /* required in IE 6 */
|
||||
outline: 0; /* prevent dotted border in Firefox */
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-selected{
|
||||
background:#CEE1EF none repeat scroll 0% 50%;
|
||||
font-weight:bold;
|
||||
-moz-border-radius-topright: 4px;
|
||||
-khtml-border-top-right-radius: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
-moz-border-radius-topleft: 4px;
|
||||
-khtml-border-top-left-radius: 4px;
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-selected a {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
z-index: 2;
|
||||
margin-top: 0;
|
||||
color:#333333;
|
||||
}
|
||||
.ui-tabs-nav li a:hover {
|
||||
color:#D54E21;
|
||||
}
|
||||
.ui-tabs-nav a span {
|
||||
width: 64px; /* IE 6 treats width as min-width */
|
||||
min-width: 64px;
|
||||
height: 18px; /* IE 6 treats height as min-height */
|
||||
min-height: 18px;
|
||||
padding-top: 6px;
|
||||
padding-right: 0;
|
||||
}
|
||||
*>.ui-tabs-nav a span { /* hide from IE 6 */
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-selected a span {
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active {
|
||||
background-position: 100% -150px;
|
||||
}
|
||||
.ui-tabs-nav a, .ui-tabs-nav .ui-tabs-disabled a:hover, .ui-tabs-nav .ui-tabs-disabled a:focus, .ui-tabs-nav .ui-tabs-disabled a:active {
|
||||
background-position: 100% -100px;
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-selected a span, .ui-tabs-nav a:hover span, .ui-tabs-nav a:focus span, .ui-tabs-nav a:active span {
|
||||
background-position: 0 -50px;
|
||||
}
|
||||
.ui-tabs-nav a span, .ui-tabs-nav .ui-tabs-disabled a:hover span, .ui-tabs-nav .ui-tabs-disabled a:focus span, .ui-tabs-nav .ui-tabs-disabled a:active span {
|
||||
background-position: 0 0;
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited, .ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */
|
||||
cursor: text;
|
||||
}
|
||||
.ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active,
|
||||
.ui-tabs-nav .ui-tabs-unselect a:hover, .ui-tabs-nav .ui-tabs-unselect a:focus, .ui-tabs-nav .ui-tabs-unselect a:active { /* @ Opera, we need to be explicit again here now... */
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-tabs-disabled {
|
||||
opacity: .4;
|
||||
filter: alpha(opacity=40);
|
||||
}
|
||||
.ui-tabs-panel {
|
||||
border-top: 1px solid #97a5b0 !important;
|
||||
padding: 1em 8px;
|
||||
background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */
|
||||
|
||||
/* overwrite wp-admin */
|
||||
border:none !important;
|
||||
height:100% !important;
|
||||
margin:0pt 0pt 0pt 0px !important;
|
||||
overflow:visible !important;
|
||||
}
|
||||
|
||||
.ui-tabs-panel a {
|
||||
display:inline;
|
||||
}
|
||||
|
||||
.ui-tabs-loading em {
|
||||
padding: 0 0 0 20px;
|
||||
background: url(loading.gif) no-repeat 0 50%;
|
||||
}
|
||||
|
||||
/* Additional IE specific bug fixes... */
|
||||
* html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
|
||||
display: inline-block;
|
||||
}
|
||||
*:first-child+html .ui-tabs-nav { /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
@ -1,191 +0,0 @@
|
||||
table#wpsc_checkout_list{
|
||||
width:100%;
|
||||
}
|
||||
th#trash{
|
||||
width:40px;
|
||||
}
|
||||
th#drag{
|
||||
width:29px;
|
||||
}
|
||||
tr.wpsc_grey{
|
||||
background-color: #ededed;
|
||||
}
|
||||
td.drag a:hover{
|
||||
|
||||
/*background-image: url(../../images/roll-over-drag.jpg);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;*/
|
||||
cursor: move;
|
||||
}
|
||||
th#mandatory{
|
||||
width:65px;
|
||||
}
|
||||
#wpsc_checkout_list th#name{
|
||||
width:180px;
|
||||
}
|
||||
td.mandatorycol{
|
||||
text-align: center;
|
||||
}
|
||||
tr.checkout-placeholder {
|
||||
border-width: 1px;
|
||||
border-style: dashed;
|
||||
z-index: 900;
|
||||
border-color: #bbb;
|
||||
background-color: #f5f5f5;
|
||||
margin: -2px 0 0 -2px;
|
||||
}
|
||||
#wpsc_checkout_list tbody {
|
||||
width: 700px;
|
||||
border-collapse:collapse;
|
||||
}
|
||||
|
||||
/* Removed to prevent overlapping the Contextual Help tab
|
||||
#wpsc_options {
|
||||
position: relative;
|
||||
}
|
||||
*/
|
||||
|
||||
#wpsc_options a.about_this_page {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
#wpsc_options_page {
|
||||
padding: 0px 0px 0px 5px;
|
||||
}
|
||||
|
||||
#options_presentation{
|
||||
min-width:850px;
|
||||
}
|
||||
|
||||
table#gateway_options tr td {
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
table#gateway_options tr td.gateway_settings {
|
||||
padding: 0 0 8px 8px;
|
||||
width:394px;
|
||||
}
|
||||
td.gateway_settings input[type=text]{
|
||||
width: 200px;
|
||||
}
|
||||
tr.rate_row td input[type=text]{
|
||||
width:50px;
|
||||
}
|
||||
div.wpsc_newlayer input[type=text]{
|
||||
width:50px;
|
||||
}
|
||||
td.gateway_settings textarea{
|
||||
width:100%;
|
||||
}
|
||||
td.gateway_settings h4{
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
.wpsc_shipping_options{
|
||||
border-top: 1px solid #e9e9e9;
|
||||
|
||||
}
|
||||
td.select_gateway p {
|
||||
margin: 0px 15px 4px 5px;
|
||||
}
|
||||
|
||||
div#wpsc_shipwire_setting, div#shipping_discount_value {
|
||||
display: none;
|
||||
}
|
||||
|
||||
table#gateway_options {
|
||||
margin:0;
|
||||
width:100%;
|
||||
}
|
||||
/* admin checkout page css */
|
||||
div#form_field_form_container{ padding: 0px; margin: 0px; }
|
||||
|
||||
div#form_field_form_container div, div#form_field_form_container div table{ padding: 0px; margin: 0px; width: 100%; border-collapse: collapse; }
|
||||
table#form_field_table tr td.namecol{ }
|
||||
|
||||
table#form_field_table tr *.namecol{ width: 170px; padding-right: 8px; }
|
||||
table#form_field_table tr *.namecol input{ width: 160px; }
|
||||
|
||||
table#form_field_table tr *.typecol{ width: 120px; }
|
||||
table#form_field_table tr *.typecol select{ width: 115px; }
|
||||
|
||||
table#form_field_table tr *.mandatorycol{ width: 90px; text-align: center; }
|
||||
table#form_field_table tr *.mandatorycol input{ }
|
||||
|
||||
table#form_field_table tr *.logdisplaycol{ width: 70px; text-align: center; }
|
||||
table#form_field_table tr *.logdisplaycol input{ }
|
||||
|
||||
table#form_field_table tr *.ordercol{ width: 70px; text-align: center; }
|
||||
table#form_field_table tr *.ordercol input{ }
|
||||
|
||||
table#form_field_table tr th{ padding-left: 0px; padding-right: 0px; }
|
||||
|
||||
.flag_email{
|
||||
width:16px;
|
||||
float:right;
|
||||
}
|
||||
|
||||
#wpsc_settingpage_nav_spacer{
|
||||
width:35%;
|
||||
float:right;
|
||||
height:30px;
|
||||
border-bottom:1px solid #dfdfdf;
|
||||
}
|
||||
|
||||
#wpsc_settings_nav_bar {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#wpsc_settings_nav_bar ul {
|
||||
width: 98%;
|
||||
border-bottom: 1px solid #DFDFDF;
|
||||
float: left;
|
||||
margin: 10px auto 0;
|
||||
padding-left: 15px;
|
||||
}
|
||||
#wpsc_settings_nav_bar ul li a{
|
||||
margin-bottom:-1px;
|
||||
}
|
||||
|
||||
#wpsc_settings_nav_bar ul li a.current {
|
||||
background-color: #f9f9f9 !important;
|
||||
border-bottom-color: transparent !important;
|
||||
}
|
||||
|
||||
h3.form_group {
|
||||
clear: both;
|
||||
}
|
||||
h3.form_group a{
|
||||
color: #000;
|
||||
}
|
||||
div.product_and_button_settings {
|
||||
width: 450px;
|
||||
float: left;
|
||||
|
||||
}
|
||||
|
||||
div#themes_and_appearance {
|
||||
border: 1px solid #DFDFDF;
|
||||
width: 360px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div#themes_and_appearance p {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
span.display-path {
|
||||
color:#666666;
|
||||
}
|
||||
|
||||
div#themes_and_appearance ol {
|
||||
font-size: 11px;
|
||||
list-style-type:decimal;
|
||||
list-style-position:inside;
|
||||
}
|
||||
|
||||
div#themes_and_appearance ol li {
|
||||
font-size: 11px;
|
||||
}
|
||||
@ -1,407 +0,0 @@
|
||||
<?php
|
||||
|
||||
function wpsc_display_coupons_page() {
|
||||
global $wpdb;
|
||||
if ( isset( $_POST ) && is_array( $_POST ) && !empty( $_POST ) ) {
|
||||
|
||||
if ( isset( $_POST['add_coupon'] ) && ($_POST['add_coupon'] == 'true') && (!isset( $_POST['is_edit_coupon'] ) || !($_POST['is_edit_coupon'] == 'true')) ) {
|
||||
|
||||
$coupon_code = $_POST['add_coupon_code'];
|
||||
$discount = (double)$_POST['add_discount'];
|
||||
$discount_type = (int)$_POST['add_discount_type'];
|
||||
$use_once = (int)(bool)$_POST['add_use-once'];
|
||||
$every_product = (int)(bool)$_POST['add_every_product'];
|
||||
$is_active = (int)(bool)$_POST['add_active'];
|
||||
$start_date = date( 'Y-m-d', strtotime( $_POST['add_start'] ) ) . " 00:00:00";
|
||||
$end_date = date( 'Y-m-d', strtotime( $_POST['add_end'] ) ) . " 00:00:00";
|
||||
$rules = $_POST['rules'];
|
||||
|
||||
foreach ( $rules as $key => $rule ) {
|
||||
foreach ( $rule as $k => $r ) {
|
||||
$new_rule[$k][$key] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $new_rule as $key => $rule ) {
|
||||
if ( '' == $rule['value'] ) {
|
||||
unset( $new_rule[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $wpdb->query( "INSERT INTO `" . WPSC_TABLE_COUPON_CODES . "` ( `coupon_code` , `value` , `is-percentage` , `use-once` , `is-used` , `active` , `every_product` , `start` , `expiry`, `condition` ) VALUES ( '$coupon_code', '$discount', '$discount_type', '$use_once', '0', '$is_active', '$every_product', '$start_date' , '$end_date' , '" . serialize( $new_rule ) . "' );" ) )
|
||||
echo "<div class='updated'><p align='center'>" . __( 'Thanks, the coupon has been added.', 'wpsc' ) . "</p></div>";
|
||||
|
||||
}
|
||||
|
||||
if ( isset( $_POST['is_edit_coupon'] ) && ($_POST['is_edit_coupon'] == 'true') && !(isset( $_POST['delete_condition'] )) && !(isset( $_POST['submit_condition'] )) ) {
|
||||
|
||||
foreach ( (array)$_POST['edit_coupon'] as $coupon_id => $coupon_data ) {
|
||||
|
||||
$coupon_id = (int)$coupon_id;
|
||||
$coupon_data['start'] = $coupon_data['start'] . " 00:00:00";
|
||||
$coupon_data['expiry'] = $coupon_data['expiry'] . " 00:00:00";
|
||||
$check_values = $wpdb->get_row( "SELECT `id`, `coupon_code`, `value`, `is-percentage`, `use-once`, `active`, `start`, `expiry`,`every_product` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '$coupon_id'", ARRAY_A );
|
||||
|
||||
// Sort both arrays to make sure that if they contain the same stuff,
|
||||
// that they will compare to be the same, may not need to do this, but what the heck
|
||||
if ( $check_values != null )
|
||||
ksort( $check_values );
|
||||
|
||||
ksort( $coupon_data );
|
||||
|
||||
if ( $check_values != $coupon_data ) {
|
||||
|
||||
$insert_array = array();
|
||||
|
||||
foreach ( $coupon_data as $coupon_key => $coupon_value ) {
|
||||
if ( ($coupon_key == "submit_coupon") || ($coupon_key == "delete_coupon") )
|
||||
continue;
|
||||
|
||||
if ( isset( $check_values[$coupon_key] ) && $coupon_value != $check_values[$coupon_key] )
|
||||
$insert_array[] = "`$coupon_key` = '$coupon_value'";
|
||||
|
||||
}
|
||||
|
||||
if ( isset( $check_values['every_product'] ) && $coupon_data['add_every_product'] != $check_values['every_product'] )
|
||||
$insert_array[] = "`every_product` = '$coupon_data[add_every_product]'";
|
||||
|
||||
if ( count( $insert_array ) > 0 )
|
||||
$wpdb->query( "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET " . implode( ", ", $insert_array ) . " WHERE `id` = '$coupon_id' LIMIT 1;" );
|
||||
|
||||
unset( $insert_array );
|
||||
$rules = $_POST['rules'];
|
||||
|
||||
foreach ( (array)$rules as $key => $rule ) {
|
||||
foreach ( $rule as $k => $r ) {
|
||||
$new_rule[$k][$key] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( (array)$new_rule as $key => $rule ) {
|
||||
if ( $rule['value'] == '' ) {
|
||||
unset( $new_rule[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
$conditions = $wpdb->get_var( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1" );
|
||||
$conditions = unserialize( $conditions );
|
||||
$new_cond = array();
|
||||
|
||||
if ( $_POST['rules']['value'][0] != '' ) {
|
||||
$new_cond['property'] = $_POST['rules']['property'][0];
|
||||
$new_cond['logic'] = $_POST['rules']['logic'][0];
|
||||
$new_cond['value'] = $_POST['rules']['value'][0];
|
||||
$conditions [] = $new_cond;
|
||||
}
|
||||
|
||||
$sql = "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET `condition`='" . serialize( $conditions ) . "' WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1";
|
||||
$wpdb->query( $sql );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_POST['delete_condition'] ) ) {
|
||||
|
||||
$conditions = $wpdb->get_var( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1" );
|
||||
$conditions = unserialize( $conditions );
|
||||
|
||||
unset( $conditions[(int)$_POST['delete_condition']] );
|
||||
|
||||
$sql = "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET `condition`='" . serialize( $conditions ) . "' WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1";
|
||||
$wpdb->query( $sql );
|
||||
}
|
||||
|
||||
if ( isset( $_POST['submit_condition'] ) ) {
|
||||
$conditions = $wpdb->get_var( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1" );
|
||||
$conditions = unserialize( $conditions );
|
||||
|
||||
$new_cond = array();
|
||||
$new_cond['property'] = $_POST['rules']['property'][0];
|
||||
$new_cond['logic'] = $_POST['rules']['logic'][0];
|
||||
$new_cond['value'] = $_POST['rules']['value'][0];
|
||||
$conditions[] = $new_cond;
|
||||
|
||||
$sql = "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET `condition`='" . serialize( $conditions ) . "' WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1";
|
||||
$wpdb->query( $sql );
|
||||
}
|
||||
} ?>
|
||||
|
||||
<script type='text/javascript'>
|
||||
jQuery(".pickdate").datepicker();
|
||||
/* jQuery datepicker selector */
|
||||
if (typeof jQuery('.pickdate').datepicker != "undefined") {
|
||||
jQuery('.pickdate').datepicker({ dateFormat: 'yy-mm-dd' });
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrap">
|
||||
<h2>
|
||||
<?php _e( 'Coupons', 'wpsc' ); ?>
|
||||
<a href="#" id="add_coupon_box_link" class="add_item_link button add-new-h2" onClick="return show_status_box( 'add_coupon_box', 'add_coupon_box_link' );">
|
||||
<?php _e( 'Add New', 'wpsc' ); ?>
|
||||
</a>
|
||||
</h2>
|
||||
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td id="coupon_data">
|
||||
<div id='add_coupon_box' class='modify_coupon' >
|
||||
<form name='add_coupon' method='post' action=''>
|
||||
<table class='add-coupon' >
|
||||
<tr>
|
||||
<th><?php _e( 'Coupon Code', 'wpsc' ); ?></th>
|
||||
<th><?php _e( 'Discount', 'wpsc' ); ?></th>
|
||||
<th><?php _e( 'Start', 'wpsc' ); ?></th>
|
||||
<th><?php _e( 'Expiry', 'wpsc' ); ?></th>
|
||||
<!--
|
||||
<th><?php _e( 'Use Once', 'wpsc' ); ?></th>
|
||||
<th><?php _e( 'Active', 'wpsc' ); ?></th>
|
||||
<th><?php _e( 'Apply On All Products', 'wpsc' ); ?></th>
|
||||
-->
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type='text' value='' name='add_coupon_code' />
|
||||
</td>
|
||||
<td>
|
||||
<input type='text' value='' size='3' name='add_discount' />
|
||||
<select name='add_discount_type'>
|
||||
<option value='0' >$</option>
|
||||
<option value='1' >%</option>
|
||||
<option value='2' ><?php _e( 'Free shipping', 'wpsc' ); ?></option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type='text' class='pickdate' size='11' value="<?php echo date('Y-m-d'); ?>" name='add_start' />
|
||||
</td>
|
||||
<td>
|
||||
<input type='text' class='pickdate' size='11' name='add_end' value="<?php echo (date('Y')+1) . date('-m-d') ; ?>">
|
||||
</td>
|
||||
<td>
|
||||
<input type='hidden' value='true' name='add_coupon' />
|
||||
<input type='submit' value='Add Coupon' name='submit_coupon' class='button-primary' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan='3' scope="row">
|
||||
<p>
|
||||
<span class='input_label'><?php _e( 'Active', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_active' />
|
||||
<input type='checkbox' value='1' checked='checked' name='add_active' />
|
||||
<span class='description'><?php _e( 'Activate coupon on creation.', 'wpsc' ) ?></span>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan='3' scope="row">
|
||||
<p>
|
||||
<span class='input_label'><?php _e( 'Use Once', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_use-once' />
|
||||
<input type='checkbox' value='1' name='add_use-once' />
|
||||
<span class='description'><?php _e( 'Deactivate coupon after it has been used.', 'wpsc' ) ?></span>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan='3' scope="row">
|
||||
<p>
|
||||
<span class='input_label'><?php _e( 'Apply On All Products', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_every_product' />
|
||||
<input type="checkbox" value="1" name='add_every_product'/>
|
||||
<span class='description'><?php _e( 'This coupon affects each product at checkout.', 'wpsc' ) ?></span>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan='3'><span id='table_header'>Conditions</span></td></tr>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<div class='coupon_condition' >
|
||||
<div class='first_condition'>
|
||||
<select class="ruleprops" name="rules[property][]">
|
||||
<option value="item_name" rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
|
||||
<option value="item_quantity" rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
|
||||
<option value="total_quantity" rel="order"><?php _e( 'Total quantity', 'wpsc' ); ?></option>
|
||||
<option value="subtotal_amount" rel="order"><?php _e( 'Subtotal amount', 'wpsc' ); ?></option>
|
||||
<?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>
|
||||
</select>
|
||||
|
||||
<select name="rules[logic][]">
|
||||
<option value="equal"><?php _e( 'Is equal to', 'wpsc' ); ?></option>
|
||||
<option value="greater"><?php _e( 'Is greater than', 'wpsc' ); ?></option>
|
||||
<option value="less"><?php _e( 'Is less than', 'wpsc' ); ?></option>
|
||||
<option value="contains"><?php _e( 'Contains', 'wpsc' ); ?></option>
|
||||
<option value="not_contain"><?php _e( 'Does not contain', 'wpsc' ); ?></option>
|
||||
<option value="begins"><?php _e( 'Begins with', 'wpsc' ); ?></option>
|
||||
<option value="ends"><?php _e( 'Ends with', 'wpsc' ); ?></option>
|
||||
<option value="category"><?php _e( 'In Category', 'wpsc' ); ?></option>
|
||||
</select>
|
||||
|
||||
<span><input type="text" name="rules[value][]"/></span>
|
||||
|
||||
<span>
|
||||
<script>
|
||||
var coupon_number=1;
|
||||
function add_another_property(this_button){
|
||||
var new_property='<div class="coupon_condition">\n'+
|
||||
'<div><img height="16" width="16" class="delete" alt="Delete" src="<?php echo WPSC_CORE_IMAGES_URL; ?>/cross.png" onclick="jQuery(this).parent().remove();"/> \n'+
|
||||
'<select class="ruleprops" name="rules[property][]"> \n'+
|
||||
'<option value="item_name" rel="order">Item name</option> \n'+
|
||||
'<option value="item_quantity" rel="order">Item quantity</option>\n'+
|
||||
'<option value="total_quantity" rel="order">Total quantity</option>\n'+
|
||||
'<option value="subtotal_amount" rel="order">Subtotal amount</option>\n'+
|
||||
'<?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>'+
|
||||
'</select> \n'+
|
||||
'<select name="rules[logic][]"> \n'+
|
||||
'<option value="equal">Is equal to</option> \n'+
|
||||
'<option value="greater">Is greater than</option> \n'+
|
||||
'<option value="less">Is less than</option> \n'+
|
||||
'<option value="contains">Contains</option> \n'+
|
||||
'<option value="not_contain">Does not contain</option> \n'+
|
||||
'<option value="begins">Begins with</option> \n'+
|
||||
'<option value="ends">Ends with</option> \n'+
|
||||
'</select> \n'+
|
||||
'<span> \n'+
|
||||
'<input type="text" name="rules[value][]"/> \n'+
|
||||
'</span> \n'+
|
||||
'</div> \n'+
|
||||
'</div> ';
|
||||
|
||||
jQuery('.coupon_condition :first').after(new_property);
|
||||
coupon_number++;
|
||||
}
|
||||
</script>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a class="wpsc_coupons_condition_add" onclick="add_another_property(jQuery(this));">
|
||||
<?php _e( 'Add New Condition', 'wpsc' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
$columns = array(
|
||||
'coupon_code' => __( 'Coupon Code', 'wpsc' ),
|
||||
'discount' => __( 'Discount', 'wpsc' ),
|
||||
'start' => __( 'Start', 'wpsc' ),
|
||||
'expiry' => __( 'Expiry', 'wpsc' ),
|
||||
'active' => __( 'Active', 'wpsc' ),
|
||||
'apply_on_prods' => __( 'Apply On All Products', 'wpsc' ),
|
||||
'edit' => __( 'Edit', 'wpsc' )
|
||||
);
|
||||
register_column_headers( 'display-coupon-details', $columns );
|
||||
?>
|
||||
|
||||
<table class="coupon-list widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php print_column_headers( 'display-coupon-details' ); ?>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<?php print_column_headers( 'display-coupon-details', false ); ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
$i = 0;
|
||||
$coupon_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` ", ARRAY_A );
|
||||
|
||||
foreach ( (array)$coupon_data as $coupon ) {
|
||||
$alternate = "";
|
||||
$i++;
|
||||
if ( ($i % 2) != 0 ) {
|
||||
$alternate = "class='alt'";
|
||||
}
|
||||
echo "<tr $alternate>\n\r";
|
||||
|
||||
echo " <td>\n\r";
|
||||
esc_attr_e( $coupon['coupon_code'] );
|
||||
echo " </td>\n\r";
|
||||
|
||||
echo " <td>\n\r";
|
||||
if ( $coupon['is-percentage'] == 1 )
|
||||
echo esc_attr( $coupon['value'] ) . "%";
|
||||
|
||||
else if ( $coupon['is-percentage'] == 2 )
|
||||
echo __("Free Shipping", 'wpsc');
|
||||
|
||||
else
|
||||
echo wpsc_currency_display( esc_attr( $coupon['value'] ) );
|
||||
|
||||
echo " </td>\n\r";
|
||||
|
||||
echo " <td>\n\r";
|
||||
echo date( "d/m/Y", strtotime( esc_attr( $coupon['start'] ) ) );
|
||||
echo " </td>\n\r";
|
||||
|
||||
echo " <td>\n\r";
|
||||
echo date( "d/m/Y", strtotime( esc_attr( $coupon['expiry'] ) ) );
|
||||
echo " </td>\n\r";
|
||||
|
||||
echo " <td>\n\r";
|
||||
switch ( $coupon['active'] ) {
|
||||
case 1:
|
||||
echo "<img src='" . WPSC_CORE_IMAGES_URL . "/yes_stock.gif' alt='' title='' />";
|
||||
break;
|
||||
|
||||
case 0: default:
|
||||
echo "<img src='" . WPSC_CORE_IMAGES_URL . "/no_stock.gif' alt='' title='' />";
|
||||
break;
|
||||
}
|
||||
echo " </td>\n\r";
|
||||
|
||||
echo " <td>\n\r";
|
||||
switch ( $coupon['every_product'] ) {
|
||||
case 1:
|
||||
echo "<img src='" . WPSC_CORE_IMAGES_URL . "/yes_stock.gif' alt='' title='' />";
|
||||
break;
|
||||
|
||||
case 0: default:
|
||||
echo "<img src='" . WPSC_CORE_IMAGES_URL . "/no_stock.gif' alt='' title='' />";
|
||||
break;
|
||||
}
|
||||
|
||||
echo " </td>\n\r";
|
||||
echo " <td>\n\r";
|
||||
echo "<a title='" . esc_attr( $coupon['coupon_code'] ). "' href='#' rel='" . $coupon['id'] . "' class='wpsc_edit_coupon' >" . __( 'Edit', 'wpsc' ) . "</a>";
|
||||
echo " </td>\n\r";
|
||||
echo " </tr>\n\r";
|
||||
echo " <tr class='coupon_edit'>\n\r";
|
||||
echo " <td colspan='7' style='padding-left:0px;'>\n\r";
|
||||
echo " <div id='coupon_box_" . $coupon['id'] . "' class='displaynone modify_coupon' >\n\r";
|
||||
coupon_edit_form( $coupon );
|
||||
echo " </div>\n\r";
|
||||
echo " </td>\n\r";
|
||||
echo " </tr>\n\r";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p style='margin: 10px 0px 5px 0px;'>
|
||||
<?php _e( '<strong>Note:</strong> Due to a current PayPal limitation, when a purchase is made using a coupon we cannot send a detailed list of items through for processing. Instead we send the total amount of the purchase so the customer will see your shop name and the total within PayPal.', 'wpsc' ); ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,348 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* WP eCommerce Debug page and functions
|
||||
*
|
||||
* This is debugging and unsafe updating code to debug or fix specific problems on some sites that is either not safe to run automatically or not usually needed
|
||||
* It is unwise to use anything on this page unless you know exactly what it will do and why you need to run it.
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.7
|
||||
*/
|
||||
function wpsc_debug_page() {
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die("You don't look like an administrator.");
|
||||
global $wpdb;
|
||||
$fixpage = get_option( 'siteurl' ) . '/wp-admin/admin.php?page=wpsc-sales-logs&subpage=upgrade-purchase-logs';
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2>Debugging Page</h2>
|
||||
<?php
|
||||
if ( !isset( $_GET['wpsc_debug_action'] ) ) {
|
||||
?>
|
||||
<p>
|
||||
This is debugging and unsafe updating code to debug or fix specific problems on some sites that is either not safe to run automatically or not usually needed<br />
|
||||
It is unwise to use anything on this page unless you know exactly what it will do and why you need to run it.
|
||||
</p>
|
||||
<h4>Action List</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<a href='?page=wpsc-debug&wpsc_debug_action=convert_products_to_posts'>Convert Products to Posts</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='?page=wpsc-debug&wpsc_debug_action=phpinfo'>Display phpinfo</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='?page=wpsc-debug&wpsc_debug_action=wpsc_expire_subscriptions'>Expire Subscriptions</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='<?php echo $fixpage; ?>'>Fix Purchaselogs</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='<?php echo wp_nonce_url("?wpsc_admin_action=update_page_urls"); ?>' ><?php _e('Update Page URLs', 'wpsc'); ?></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='<?php echo wp_nonce_url("?wpsc_admin_action=clean_categories"); ?>'><?php _e('Fix Product Group Permalinks', 'wpsc'); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<?php
|
||||
if ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && (constant( 'WPSC_ADD_DEBUG_PAGE' ) == true) ) {
|
||||
?>
|
||||
<h4>Development Code List</h4>
|
||||
<p> And this code is probably useless for anything other than working out how to write better code to do the same thing, unless you want to do that, leave it alone</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href='?page=wpsc-debug&wpsc_debug_action=unicode_permalinks'>Test Unicode Category permalinks</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href='?page=wpsc-debug&wpsc_debug_action=create_also_bought_list'>Create also bought list</a>
|
||||
</li>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<pre style='font-family:\"Lucida Grande\",Verdana,Arial,\"Bitstream Vera Sans\",sans-serif; font-size:8px;'><?php
|
||||
switch ( $_GET['wpsc_debug_action'] ) {
|
||||
case 'convert_products_to_posts':
|
||||
wpsc_convert_products_to_posts();
|
||||
break;
|
||||
|
||||
case 'download_links':
|
||||
wpsc_group_and_update_download_links();
|
||||
break;
|
||||
|
||||
|
||||
case 'product_url_names':
|
||||
wpsc_clean_product_url_names();
|
||||
break;
|
||||
|
||||
case 'redo_product_url_names':
|
||||
wpsc_redo_product_url_names();
|
||||
break;
|
||||
|
||||
|
||||
case 'test_copying_themes':
|
||||
wpsc_test_copying_themes();
|
||||
break;
|
||||
|
||||
case 'test_making_product_url_names':
|
||||
wpsc_test_making_product_url_names();
|
||||
break;
|
||||
|
||||
case 'resize_thumbnails':
|
||||
wpsc_mass_resize_thumbnails_and_clean_images();
|
||||
break;
|
||||
|
||||
case 'images_reupload':
|
||||
wpsc_update_image_records( true );
|
||||
break;
|
||||
|
||||
case 'filters':
|
||||
global $wp_filter, $merged_filters;
|
||||
print_r( $wp_filter );
|
||||
break;
|
||||
|
||||
case 'wpsc_expire_subscriptions':
|
||||
if ( function_exists( 'wpsc_expire_subscriptions' ) ) {
|
||||
wpsc_expire_subscriptions();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'phpinfo':
|
||||
echo "</pre>";
|
||||
phpinfo();
|
||||
echo "<pre style='font-family:\"Lucida Grande\",Verdana,Arial,\"Bitstream Vera Sans\",sans-serif; font-size:8px;'>";
|
||||
break;
|
||||
|
||||
case 'wp-cron':
|
||||
$cron = get_option( 'cron' );
|
||||
print_r( $cron );
|
||||
break;
|
||||
|
||||
case 'wp_get_object_terms':
|
||||
global $wp_taxonomies;
|
||||
$tags = wp_get_object_terms( 108, 'product_tag', array( 'fields' => 'names' ) );
|
||||
print_r( $tags );
|
||||
break;
|
||||
|
||||
case 'unicode_permalinks':
|
||||
$original_string = "バンプ・オブ・チキン";
|
||||
$sanitized_string = sanitize_title( $original_string );
|
||||
$string_regex = str_replace( "%", "\x", $sanitized_string );
|
||||
$full_regex = "/^({$string_regex}){1}$/";
|
||||
|
||||
echo "Original String: {$original_string} \n";
|
||||
echo "Sanitized String: {$sanitized_string} \n";
|
||||
echo "String regex: {$string_regex} \n";
|
||||
echo "Full regex: {$full_regex} \n";
|
||||
|
||||
if ( preg_match( $full_regex, $original_string ) ) {
|
||||
echo "<strong>Matches</strong>";
|
||||
} else {
|
||||
echo "<strong>Does Not Match</strong>";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
?></pre>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wpsc_test_copying_themes() {
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die("You don't look like an administrator.");
|
||||
|
||||
$new_dir = @opendir( WPSC_THEMES_PATH );
|
||||
$num = 0;
|
||||
$file_names = array();
|
||||
|
||||
while ( false !== ( $file = @readdir( $new_dir ) ) ) {
|
||||
if ( is_dir( WPSC_THEMES_PATH . $file ) && ( $file != ".." ) && ( $file != "." ) ) {
|
||||
$file_names[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $file_names ) < 1 ) {
|
||||
$old_dir = @opendir( WPSC_CORE_THEME_PATH );
|
||||
while ( ($file = @readdir( $old_dir )) !== false ) {
|
||||
if ( is_dir( WPSC_CORE_THEME_PATH . $file ) && ( $file != ".." ) && ( $file != "." ) ) {
|
||||
$success = wpsc_recursive_copy( WPSC_CORE_THEME_PATH . $file, WPSC_THEMES_PATH . $file );
|
||||
echo "old_file:" . WPSC_CORE_THEME_PATH . $file . "<br />";
|
||||
echo "new_file:" . WPSC_THEMES_PATH . $file . "<br />";
|
||||
echo "<pre>" . print_r( $success, true ) . "</pre>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_group_and_update_download_links() {
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die("You don't look like an administrator.");
|
||||
global $wpdb;
|
||||
$unique_file_names = $wpdb->get_col( "SELECT DISTINCT `filename` FROM `" . WPSC_TABLE_PRODUCT_FILES . "`" );
|
||||
foreach ( (array)$unique_file_names as $filename ) {
|
||||
echo "$filename \n";
|
||||
$file_id_list = array( );
|
||||
$file_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `filename` IN ('$filename')", ARRAY_A );
|
||||
foreach ( $file_data as $file_row ) {
|
||||
$file_id_list[] = $file_row['id'];
|
||||
}
|
||||
$product_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `file` IN ('" . implode( "', '", $file_id_list ) . "') AND `active` IN('1') ORDER BY `id` DESC LIMIT 1 ", ARRAY_A );
|
||||
$product_id = $product_data['id'];
|
||||
if ( $product_id > 0 ) {
|
||||
if ( $wpdb->query( "UPDATE `" . WPSC_TABLE_PRODUCT_FILES . "` SET `product_id` = '{$product_id}' WHERE `id` IN ('" . implode( "', '", $file_id_list ) . "')" ) ) {
|
||||
if ( $wpdb->query( "UPDATE `" . WPSC_TABLE_DOWNLOAD_STATUS . "` SET `product_id` = '{$product_id}' WHERE `fileid` IN ('" . implode( "', '", $file_id_list ) . "')" ) ) {
|
||||
echo "$filename done \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_clean_product_url_names, cleans dupicates
|
||||
*/
|
||||
function wpsc_clean_product_url_names() {
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die("You don't look like an administrator.");
|
||||
global $wpdb;
|
||||
|
||||
$duplicated_meta_data = $wpdb->get_col( "SELECT `meta_value` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `meta_key` IN('url_name') GROUP BY `meta_value` HAVING COUNT(`meta_value`) > 1 " );
|
||||
|
||||
$product_data = $wpdb->get_results( "SELECT DISTINCT `products`.* FROM `" . WPSC_TABLE_PRODUCTMETA . "` AS `meta` LEFT JOIN `" . WPSC_TABLE_PRODUCT_LIST . "` AS `products` ON `meta`.`product_id` = `products`.`id` WHERE `meta`.`meta_key` IN('url_name') AND `meta`.`meta_value` IN('" . implode( "', '", $duplicated_meta_data ) . "') AND `products`.`active` = '1' ORDER BY `meta`.`meta_value` DESC", ARRAY_A );
|
||||
|
||||
foreach ( (array)$product_data as $product_row ) {
|
||||
if ( $product_row['name'] != '' ) {
|
||||
$tidied_name = strtolower( trim( stripslashes( $product_row['name'] ) ) );
|
||||
$url_name = sanitize_title( $tidied_name );
|
||||
$similar_names = $wpdb->get_row( "SELECT COUNT(*) AS `count`, MAX(REPLACE(`meta_value`, '$url_name', '')) AS `max_number` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `meta_key` IN ('url_name') AND `meta_value` REGEXP '^($url_name){1}[[:digit:]]*$' ", ARRAY_A );
|
||||
$extension_number = '';
|
||||
if ( $similar_names['count'] > 0 ) {
|
||||
$extension_number = (int)$similar_names['max_number'] + 1;
|
||||
}
|
||||
$url_name .= $extension_number;
|
||||
echo "{$product_row['name']} => {$url_name}\n\r";
|
||||
update_product_meta( $product_row['id'], 'url_name', $url_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_redo_product_url_names, deletes all product URL names, then remakes then
|
||||
*/
|
||||
function wpsc_redo_product_url_names() {
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die("You don't look like an administrator.");
|
||||
global $wpdb;
|
||||
|
||||
$product_data = $wpdb->get_results( "SELECT DISTINCT `products`.* FROM `" . WPSC_TABLE_PRODUCTMETA . "` AS `meta` LEFT JOIN `" . WPSC_TABLE_PRODUCT_LIST . "` AS `products` ON `meta`.`product_id` = `products`.`id` WHERE `products`.`active` = '1' ORDER BY `meta`.`meta_value` DESC", ARRAY_A );
|
||||
|
||||
foreach ( (array)$product_data as $product_row ) {
|
||||
$product_id = $product_row['id'];
|
||||
$post_data = $product_row;
|
||||
|
||||
|
||||
if ( $post_data['name'] != '' ) {
|
||||
$existing_name = get_product_meta( $product_id, 'url_name' );
|
||||
$tidied_name = strtolower( trim( stripslashes( $post_data['name'] ) ) );
|
||||
$url_name = sanitize_title( $tidied_name );
|
||||
|
||||
$similar_names = (array)$wpdb->get_col( "SELECT `meta_value` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `product_id` NOT IN('{$product_id}}') AND `meta_key` IN ('url_name') AND `meta_value` REGEXP '^(" . $wpdb->escape( preg_quote( $url_name ) ) . "){1}[[:digit:]]*$' " );
|
||||
|
||||
echo "<strong>Product {$product_id}:</strong> {$product_row['name']}\n";
|
||||
echo "Current Name: {$existing_name}\n";
|
||||
echo "Originally Proposed Name: {$url_name}\n";
|
||||
|
||||
if ( array_search( $url_name, $similar_names ) !== false ) {
|
||||
$i = 0;
|
||||
do {
|
||||
$i++;
|
||||
echo "Proposed Name #$i: " . ($url_name . $i) . "\n";
|
||||
} while ( array_search( ($url_name . $i ), $similar_names ) !== false );
|
||||
$url_name .= $i;
|
||||
}
|
||||
echo "Accepted Name: {$url_name}\n";
|
||||
|
||||
|
||||
if ( $existing_name != $url_name ) {
|
||||
update_product_meta( $product_id, 'url_name', $url_name );
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_recreate_product_url_names() {
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die("You don't look like an administrator.");
|
||||
global $wpdb;
|
||||
|
||||
$product_data = $wpdb->get_results( "SELECT `id`, `name` FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `active` IN ('1')", ARRAY_A );
|
||||
echo "<pre>";
|
||||
foreach ( $product_data as $product_row ) {
|
||||
$product_id = $product_row['id'];
|
||||
$tidied_name = trim( $product_row['name'] );
|
||||
$tidied_name = strtolower( $tidied_name );
|
||||
$url_name = sanitize_title( $tidied_name );
|
||||
|
||||
echo "<strong>Product {$product_id}:</strong> {$product_row['name']}\n";
|
||||
|
||||
echo "Originally Proposed Name: {$url_name}\n";
|
||||
$similar_names = (array)$wpdb->get_col( "SELECT `meta_value` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `product_id` NOT IN('{$product_id}}') AND `meta_key` IN ('url_name') AND `meta_value` REGEXP '^(" . $wpdb->escape( preg_quote( $url_name ) ) . "){1}[[:digit:]]*$' " );
|
||||
|
||||
if ( array_search( $url_name, $similar_names ) !== false ) {
|
||||
// If it is, try to add a number to the end, if that is taken, try the next highest number...
|
||||
$i = 0;
|
||||
do {
|
||||
$i++;
|
||||
if ( $i > 100 ) {
|
||||
break;
|
||||
}
|
||||
echo "Proposed Name #$i: " . ($url_name . $i) . "\n";
|
||||
} while ( array_search( ($url_name . $i ), $similar_names ) !== false );
|
||||
// Concatenate the first number found that wasn't taken
|
||||
$url_name .= $i;
|
||||
}
|
||||
|
||||
echo "Accepted Name: {$url_name}\n";
|
||||
$existing_name = get_product_meta( $product_id, 'url_name', true );
|
||||
if ( is_array( $existing_name ) ) {
|
||||
$existing_name = array_pop( $existing_name );
|
||||
}
|
||||
if ( $existing_name != $url_name ) {
|
||||
update_product_meta( $product_id, 'url_name', $url_name );
|
||||
}
|
||||
|
||||
echo "\n\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_mass_resize_thumbnails_and_clean_images() {
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die("You don't look like an administrator.");
|
||||
global $wpdb;
|
||||
|
||||
$height = get_option( 'product_image_height' );
|
||||
$width = get_option( 'product_image_width' );
|
||||
|
||||
$product_data = $wpdb->get_results( "SELECT `product`.`id`, `product`.`image` AS `image_id`, `images`.`image` AS `file` FROM `" . WPSC_TABLE_PRODUCT_LIST . "` AS `product` INNER JOIN `" . WPSC_TABLE_PRODUCT_IMAGES . "` AS `images` ON `product`.`image` = `images`.`id` WHERE `product`.`image` > 0 ", ARRAY_A );
|
||||
foreach ( (array)$product_data as $product ) {
|
||||
$image_input = WPSC_IMAGE_DIR . $product['file'];
|
||||
$image_output = WPSC_THUMBNAIL_DIR . $product['file'];
|
||||
if ( ($product['file'] != '') and file_exists( $image_input ) ) {
|
||||
image_processing( $image_input, $image_output, $width, $height );
|
||||
update_product_meta( $product['id'], 'thumbnail_width', $width );
|
||||
update_product_meta( $product['id'], 'thumbnail_height', $height );
|
||||
} else {
|
||||
$wpdb->query( "DELETE FROM `" . WPSC_TABLE_PRODUCT_IMAGES . "` WHERE `id` IN('{$product['image_id']}') LIMIT 1" );
|
||||
$wpdb->query( "UPDATE `" . WPSC_TABLE_PRODUCT_LIST . "` SET `image` = NULL WHERE `id` = '" . $product['id'] . "' LIMIT 1" );
|
||||
}
|
||||
}
|
||||
$wpdb->query( "DELETE FROM `" . WPSC_TABLE_PRODUCT_IMAGES . "` WHERE `product_id` IN('0')" );
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,377 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WP eCommerce edit and add product page functions
|
||||
*
|
||||
* These are the main WPSC Admin functions
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.7
|
||||
*/
|
||||
|
||||
|
||||
require_once(WPSC_FILE_PATH . '/wpsc-admin/includes/products.php');
|
||||
|
||||
|
||||
/**
|
||||
* wpsc_additional_column_names function.
|
||||
*
|
||||
* @access public
|
||||
* @param (array) $columns
|
||||
* @return (array) $columns
|
||||
*
|
||||
*/
|
||||
function wpsc_additional_column_names( $columns ){
|
||||
$columns = array();
|
||||
|
||||
$columns['cb'] = '<input type="checkbox" />';
|
||||
$columns['image'] = '';
|
||||
$columns['title'] = __('Name', 'wpsc');
|
||||
$columns['weight'] = __('Weight', 'wpsc');
|
||||
$columns['stock'] = __('Stock', 'wpsc');
|
||||
$columns['price'] = __('Price', 'wpsc');
|
||||
$columns['sale_price'] = __('Sale Price', 'wpsc');
|
||||
$columns['SKU'] = __('SKU', 'wpsc');
|
||||
$columns['cats'] = __('Categories', 'wpsc');
|
||||
$columns['featured'] = __('Featured', 'wpsc');
|
||||
$columns['hidden_alerts'] = '';
|
||||
$columns['date'] = __('Date', 'wpsc');
|
||||
|
||||
return $columns;
|
||||
}
|
||||
function wpsc_additional_sortable_column_names( $columns ){
|
||||
|
||||
$columns['stock'] = __('Stock', 'wpsc');
|
||||
$columns['price'] = __('Price', 'wpsc');
|
||||
$columns['sale_price'] = __('Sale Price', 'wpsc');
|
||||
$columns['SKU'] = __('SKU', 'wpsc');
|
||||
|
||||
return $columns;
|
||||
}
|
||||
function wpsc_additional_column_name_variations( $columns ){
|
||||
global $post;
|
||||
|
||||
if(isset($post) && $post->post_parent != '0' )
|
||||
remove_meta_box( 'wpsc_product_variation_forms', 'wpsc-product', 'normal' );
|
||||
|
||||
$columns['image'] = '';
|
||||
$columns['title'] = __('Name', 'wpsc');
|
||||
$columns['weight'] = __('Weight', 'wpsc');
|
||||
$columns['stock'] = __('Stock', 'wpsc');
|
||||
$columns['price'] = __('Price', 'wpsc');
|
||||
$columns['sale_price'] = __('Sale Price', 'wpsc');
|
||||
$columns['SKU'] = __('SKU', 'wpsc');
|
||||
$columns['hidden_alerts'] = '';
|
||||
|
||||
//For BC for 3.0 (hoping to remove for WPEC 3.9)
|
||||
register_column_headers( 'wpsc-product_variants', $columns );
|
||||
|
||||
return apply_filters( 'wpsc_variation_column_headers', $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_additional_column_data.
|
||||
*
|
||||
* @access public
|
||||
* @param (array) $column
|
||||
* @return void
|
||||
* @todo Need to check titles / alt tags ( I don't think thumbnails have any in this code )
|
||||
* @desc Switch function to generate columns the right way...no more UI hacking!
|
||||
*
|
||||
*/
|
||||
function wpsc_additional_column_data( $column ) {
|
||||
global $post;
|
||||
|
||||
$is_parent = ( bool )wpsc_product_has_children($post->ID);
|
||||
switch ( $column ) :
|
||||
|
||||
case 'image' :
|
||||
|
||||
$attached_images = get_posts( array(
|
||||
'post_type' => 'attachment',
|
||||
'numberposts' => 1,
|
||||
'post_parent' => $post->ID,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
) );
|
||||
|
||||
if( isset( $post->ID ) && has_post_thumbnail( $post->ID ) )
|
||||
echo get_the_post_thumbnail( $post->ID, 'admin-product-thumbnails' );
|
||||
else if( !empty( $attached_images ) ) {
|
||||
$attached_image = $attached_images[0];
|
||||
$src = wp_get_attachment_url( $attached_image->ID );
|
||||
?>
|
||||
<div style='width:38px; height:38px; overflow:hidden;'>
|
||||
<img src='<?php echo $src; ?>' alt='<?php _e( 'Drag to a new position', 'wpsc' ); ?>' width='38' height='38' />
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
$image_url = WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif";
|
||||
?>
|
||||
<img src='<?php echo $image_url; ?>' alt='<?php _e( 'Drag to a new position', 'wpsc' ); ?>' width='38' height='38' />
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
case 'weight' :
|
||||
|
||||
if( $is_parent ) :
|
||||
_e( 'N/A', 'wpsc' );
|
||||
else :
|
||||
$product_data['meta'] = array();
|
||||
$product_data['meta'] = get_post_meta( $post->ID, '' );
|
||||
foreach( $product_data['meta'] as $meta_name => $meta_value )
|
||||
$product_data['meta'][$meta_name] = maybe_unserialize( array_pop( $meta_value ) );
|
||||
|
||||
$product_data['transformed'] = array();
|
||||
if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight'] ) )
|
||||
$product_data['meta']['_wpsc_product_metadata']['weight'] = "";
|
||||
if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight_unit'] ) )
|
||||
$product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
|
||||
|
||||
$product_data['transformed']['weight'] = wpsc_convert_weight( $product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'] );
|
||||
|
||||
$weight = $product_data['transformed']['weight'];
|
||||
if( $weight == '' )
|
||||
$weight = '0';
|
||||
|
||||
$unit = $product_data['meta']['_wpsc_product_metadata']['weight_unit'];
|
||||
|
||||
switch( $unit ) {
|
||||
case "pound":
|
||||
$unit = __(" lbs.", "wpsc");
|
||||
break;
|
||||
case "ounce":
|
||||
$unit = __(" oz.", "wpsc");
|
||||
break;
|
||||
case "gram":
|
||||
$unit = __(" g", "wpsc");
|
||||
break;
|
||||
case "kilograms":
|
||||
case "kilogram":
|
||||
$unit = __(" kgs.", "wpsc");
|
||||
break;
|
||||
}
|
||||
echo $weight.$unit;
|
||||
echo '<div id="inline_' . $post->ID . '_weight" class="hidden">' . $weight . '</div>';
|
||||
|
||||
endif;
|
||||
break;
|
||||
case 'stock' :
|
||||
$stock = get_post_meta( $post->ID, '_wpsc_stock', true );
|
||||
if( $stock == '' )
|
||||
$stock = __('N/A', 'wpsc');
|
||||
if( !$is_parent ) {
|
||||
echo $stock;
|
||||
echo '<div id="inline_' . $post->ID . '_stock" class="hidden">' . $stock . '</div>';
|
||||
}
|
||||
else
|
||||
echo '~'.wpsc_variations_stock_remaining( $post->ID );
|
||||
break;
|
||||
case 'price' :
|
||||
$price = get_post_meta( $post->ID, '_wpsc_price', true );
|
||||
$has_var = '1';
|
||||
if( !$is_parent ) {
|
||||
echo wpsc_currency_display( $price );
|
||||
echo '<div id="inline_' . $post->ID . '_price" class="hidden">' . trim($price) . '</div>';
|
||||
$has_var = '0';
|
||||
}
|
||||
else
|
||||
echo wpsc_product_variation_price_available( $post->ID ).'+';
|
||||
echo '<input type="hidden" value="'.$has_var.'" name="inline_' . $post->ID . '_has_var" id="inline_' . $post->ID . '_has_var" />';
|
||||
|
||||
break;
|
||||
case 'sale_price' :
|
||||
$price = get_post_meta( $post->ID, '_wpsc_special_price', true );
|
||||
if( !$is_parent ) {
|
||||
echo wpsc_currency_display( $price );
|
||||
echo '<div id="inline_' . $post->ID . '_sale_price" class="hidden">' . $price . '</div>';
|
||||
} else
|
||||
echo wpsc_product_variation_price_available( $post->ID ).'+';
|
||||
break;
|
||||
case 'SKU' :
|
||||
$sku = get_post_meta( $post->ID, '_wpsc_sku', true );
|
||||
if( $sku == '' )
|
||||
$sku = __('N/A', 'wpsc');
|
||||
|
||||
echo $sku;
|
||||
echo '<div id="inline_' . $post->ID . '_sku" class="hidden">' . $sku . '</div>';
|
||||
break;
|
||||
case 'cats' :
|
||||
$categories = get_the_product_category( $post->ID );
|
||||
if ( !empty( $categories ) ) {
|
||||
$out = array();
|
||||
foreach ( $categories as $c )
|
||||
$out[] = "<a href='?post_type=wpsc-product&wpsc_product_category={$c->slug}'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) . "</a>";
|
||||
echo join( ', ', $out );
|
||||
} else {
|
||||
_e('Uncategorized', 'wpsc');
|
||||
}
|
||||
break;
|
||||
case 'featured' :
|
||||
$featured_product_url = wp_nonce_url( "index.php?wpsc_admin_action=update_featured_product&product_id=$post->ID", 'feature_product_' . $post->ID);
|
||||
?>
|
||||
<a class="wpsc_featured_product_toggle featured_toggle_<?php echo $post->ID; ?>" href='<?php echo $featured_product_url; ?>' >
|
||||
<?php if ( in_array( $post->ID, (array)get_option( 'sticky_products' ) ) ) : ?>
|
||||
<img class='gold-star' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/gold-star.gif' alt='<?php _e( 'Unmark as Featured', 'wpsc' ); ?>' title='<?php _e( 'Unmark as Featured', 'wpsc' ); ?>' />
|
||||
<?php else: ?>
|
||||
<img class='grey-star' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/grey-star.gif' alt='<?php _e( 'Mark as Featured', 'wpsc' ); ?>' title='<?php _e( 'Mark as Featured', 'wpsc' ); ?>' />
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php
|
||||
break;
|
||||
case 'hidden_alerts' :
|
||||
$product_alert = apply_filters( 'wpsc_product_alert', array( false, '' ), $post );
|
||||
if( !empty( $product_alert['messages'] ) )
|
||||
$product_alert['messages'] = implode( "\n",( array )$product_alert['messages'] );
|
||||
|
||||
if( $product_alert['state'] === true ) {
|
||||
?>
|
||||
<img alt='<?php echo $product_alert['messages'];?>' title='<?php echo $product_alert['messages'];?>' class='product-alert-image' src='<?php echo WPSC_CORE_IMAGES_URL;?>/product-alert.jpg' alt='' />
|
||||
<?php
|
||||
}
|
||||
|
||||
// If a product alert has stuff to display, show it.
|
||||
// Can be used to add extra icons etc
|
||||
if ( !empty( $product_alert['display'] ) )
|
||||
echo $product_alert['display'];
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
}
|
||||
function wpsc_column_sql_orderby( $orderby, $wp_query ) {
|
||||
global $wpdb;
|
||||
|
||||
$wp_query->query = wp_parse_args( $wp_query->query );
|
||||
|
||||
if( isset( $wp_query->query['orderby'] ) ) :
|
||||
switch ( $wp_query->query['orderby'] ) :
|
||||
case 'stock' :
|
||||
$orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_stock') " . $wp_query->get('order');
|
||||
break;
|
||||
case 'price' :
|
||||
$orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_price') " . $wp_query->get('order');
|
||||
break;
|
||||
case 'sale_price' :
|
||||
$orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_special_price') " . $wp_query->get('order');
|
||||
break;
|
||||
case 'SKU' :
|
||||
$orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_sku') " . $wp_query->get('order');
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
|
||||
return $orderby;
|
||||
}
|
||||
function wpsc_cats_restrict_manage_posts() {
|
||||
global $typenow;
|
||||
|
||||
if ( $typenow == 'wpsc-product' ) {
|
||||
|
||||
$filters = array( 'wpsc_product_category' );
|
||||
|
||||
foreach ( $filters as $tax_slug ) {
|
||||
// retrieve the taxonomy object
|
||||
$tax_obj = get_taxonomy( $tax_slug );
|
||||
$tax_name = $tax_obj->labels->name;
|
||||
// retrieve array of term objects per taxonomy
|
||||
// output html for taxonomy dropdown filter
|
||||
echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
|
||||
echo "<option value=''>" . sprintf(_x('Show All %s', 'Show all [category name]', 'wpsc'), $tax_name) . "</option>";
|
||||
wpsc_cats_restrict_manage_posts_print_terms($tax_slug);
|
||||
echo "</select>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_cats_restrict_manage_posts_print_terms($taxonomy, $parent = 0, $level = 0){
|
||||
$prefix = str_repeat( ' ' , $level );
|
||||
$terms = get_terms( $taxonomy, array( 'parent' => $parent ) );
|
||||
if( !($terms instanceof WP_Error) && !empty($terms) )
|
||||
foreach ( $terms as $term ){
|
||||
echo '<option value="'. $term->slug . '"', ( isset($_GET[$term->taxonomy]) && $_GET[$term->taxonomy] == $term->slug) ? ' selected="selected"' : '','>' . $prefix . $term->name .' (' . $term->count .')</option>';
|
||||
wpsc_cats_restrict_manage_posts_print_terms($taxonomy, $term->term_id, $level+1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc no minors allowed
|
||||
* Restrict the products page to showing only parent products and not variations.
|
||||
* @since 3.8
|
||||
*/
|
||||
function wpsc_no_minors_allowed( $vars ) {
|
||||
global $current_screen;
|
||||
|
||||
if( $current_screen->post_type != 'wpsc-product' )
|
||||
return $vars;
|
||||
|
||||
$vars['post_parent'] = 0;
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
add_filter( 'request', 'wpsc_no_minors_allowed' );
|
||||
add_action( 'admin_head', 'wpsc_additional_column_name_variations' );
|
||||
add_action( 'restrict_manage_posts', 'wpsc_cats_restrict_manage_posts' );
|
||||
add_action( 'manage_pages_custom_column', 'wpsc_additional_column_data', 10, 2 );
|
||||
add_filter( 'manage_edit-wpsc-product_sortable_columns', 'wpsc_additional_sortable_column_names' );
|
||||
add_filter( 'manage_edit-wpsc-product_columns', 'wpsc_additional_column_names' );
|
||||
add_filter( 'manage_wpsc-product_posts_columns', 'wpsc_additional_column_names' );
|
||||
add_filter( 'posts_orderby', 'wpsc_column_sql_orderby', 10, 2 );
|
||||
|
||||
|
||||
/**
|
||||
* wpsc_update_featured_products function.
|
||||
*
|
||||
* @access public
|
||||
* @todo Should be refactored to e
|
||||
* @return void
|
||||
*/
|
||||
function wpsc_update_featured_products() {
|
||||
$is_ajax = (int)(bool)$_POST['ajax'];
|
||||
$product_id = absint( $_GET['product_id'] );
|
||||
check_admin_referer( 'feature_product_' . $product_id );
|
||||
$status = get_option( 'sticky_products' );
|
||||
|
||||
$new_status = (in_array( $product_id, $status )) ? false : true;
|
||||
|
||||
if ( $new_status ) {
|
||||
|
||||
$status[] = $product_id;
|
||||
} else {
|
||||
$status = array_diff( $status, array( $product_id ) );
|
||||
$status = array_values( $status );
|
||||
}
|
||||
update_option( 'sticky_products', $status );
|
||||
|
||||
if ( $is_ajax == true ) {
|
||||
if ( $new_status == true ) : ?>
|
||||
jQuery('.featured_toggle_<?php echo $product_id; ?>').html("<img class='gold-star' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/gold-star.gif' alt='<?php _e( 'Unmark as Featured', 'wpsc' ); ?>' title='<?php _e( 'Unmark as Featured', 'wpsc' ); ?>' />");
|
||||
<?php else: ?>
|
||||
jQuery('.featured_toggle_<?php echo $product_id; ?>').html("<img class='grey-star' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/grey-star.gif' alt='<?php _e( 'Mark as Featured', 'wpsc' ); ?>' title='<?php _e( 'Mark as Featured', 'wpsc' ); ?>' />");
|
||||
<?php
|
||||
endif;
|
||||
exit();
|
||||
}
|
||||
wp_redirect( wp_get_referer() );
|
||||
exit();
|
||||
}
|
||||
|
||||
add_filter( 'page_row_actions','my_action_row', 10, 2 );
|
||||
|
||||
function my_action_row( $actions, $post ) {
|
||||
|
||||
if ( $post->post_type != "wpsc-product" )
|
||||
return $actions;
|
||||
|
||||
$url = admin_url( 'edit.php' );
|
||||
$url = add_query_arg( array( 'wpsc_admin_action' => 'duplicate_product', 'product' => $post->ID ), $url );
|
||||
|
||||
$actions['duplicate'] = '<a href="'.esc_url( $url ).'">'._x( 'Duplicate', 'row-actions', 'wpsc' ).'</a>';
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'update_featured_product' ) )
|
||||
add_action( 'admin_init', 'wpsc_update_featured_products' );
|
||||
|
||||
if ( isset( $_GET['wpsc_admin_action'] ) && ( $_GET['wpsc_admin_action'] == 'duplicate_product' ) )
|
||||
add_action( 'admin_init', 'wpsc_duplicate_product' );
|
||||
@ -1,312 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Display Settings page
|
||||
*/
|
||||
|
||||
// Clear the previously selected shipping form session variable if you are not on the shipping page
|
||||
if ( isset( $_GET['tab'] ) )
|
||||
if( $_GET['tab'] == 'shipping' )
|
||||
if( isset( $_GET['shipping_module'] ) )
|
||||
$_SESSION['previous_shipping_name'] = $_GET['shipping_module'];
|
||||
|
||||
function wpsc_display_settings_page() { ?>
|
||||
|
||||
<div id="wpsc_options" class="wrap">
|
||||
<div id="icon_card"><br /></div>
|
||||
<h2><?php _e( 'Store Settings', 'wpsc' ); ?></h2>
|
||||
<?php
|
||||
|
||||
wpsc_the_settings_tabs();
|
||||
|
||||
if ( isset( $_GET['tab'] ) )
|
||||
$page = $_GET['tab'];
|
||||
else
|
||||
$page = 'general';
|
||||
|
||||
if ( !isset( $_GET['isocode'] ) )
|
||||
$_GET['isocode'] = '';
|
||||
|
||||
if ( preg_match( "/[a-zA-Z]{2,4}/", $_GET['isocode'] ) ) {
|
||||
include(WPSC_FILE_PATH . '/wpsc-admin/includes/tax_and_shipping.php');
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $_GET['googlecheckoutshipping'] ) ) {
|
||||
include(WPSC_FILE_PATH . '/wpsc-merchants/library/google_shipping_country.php');
|
||||
return;
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( isset( $_GET['selected_all'] ) )
|
||||
wpsc_submit_options( $_GET['selected_all'] );
|
||||
|
||||
?>
|
||||
|
||||
<div id='wpsc_options_page'>
|
||||
|
||||
<?php
|
||||
switch ( $page ) {
|
||||
case 'checkout' :
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/checkout.php' );
|
||||
wpsc_options_checkout();
|
||||
break;
|
||||
|
||||
case 'gateway' :
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/gateway.php' );
|
||||
wpsc_options_gateway();
|
||||
break;
|
||||
|
||||
case 'shipping' :
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/shipping.php' );
|
||||
wpsc_options_shipping();
|
||||
break;
|
||||
|
||||
case 'admin' :
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/admin.php' );
|
||||
wpsc_options_admin();
|
||||
break;
|
||||
|
||||
case 'presentation' :
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/presentation.php' );
|
||||
wpsc_options_presentation();
|
||||
break;
|
||||
|
||||
case 'taxes' :
|
||||
wpec_taxes_settings_page();
|
||||
break;
|
||||
|
||||
case 'marketing' :
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/marketing.php' );
|
||||
wpsc_options_marketing();
|
||||
break;
|
||||
|
||||
case 'import' :
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/import.php' );
|
||||
wpsc_options_import();
|
||||
break;
|
||||
|
||||
case 'general' :
|
||||
default :
|
||||
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/general.php' );
|
||||
wpsc_options_general();
|
||||
break;
|
||||
}
|
||||
|
||||
$_SESSION['wpsc_settings_curr_page'] = $page; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/*
|
||||
* Create settings page tabs
|
||||
*/
|
||||
|
||||
function wpsc_settings_tabs() {
|
||||
$_default_tabs = array(
|
||||
'general' => _x( 'General', 'General settings tab in Settings->Store page', 'wpsc' ),
|
||||
'presentation' => _x( 'Presentation', 'Presentation settings tab in Settings->Store page', 'wpsc' ),
|
||||
'admin' => _x( 'Admin', 'Admin settings tab in Settings->Store page', 'wpsc' ),
|
||||
'taxes' => _x( 'Taxes', 'Taxes settings tab in Settings->Store page', 'wpsc' ),
|
||||
'shipping' => _x( 'Shipping', 'Shipping settings tab in Settings->Store page', 'wpsc' ),
|
||||
'gateway' => _x( 'Payments', 'Payments settings tab in Settings->Store page', 'wpsc' ),
|
||||
'checkout' => _x( 'Checkout', 'Checkout settings tab in Settings->Store page', 'wpsc' ),
|
||||
'marketing' => _x( 'Marketing', 'Marketing settings tab in Settings->Store page', 'wpsc' ),
|
||||
'import' => _x( 'Import', 'Import settings tab in Settings->Store page', 'wpsc' )
|
||||
);
|
||||
|
||||
return apply_filters( 'wpsc_settings_tabs', $_default_tabs );
|
||||
}
|
||||
|
||||
/*
|
||||
* Display settings tabs
|
||||
*/
|
||||
|
||||
function wpsc_the_settings_tabs() {
|
||||
global $redir_tab;
|
||||
|
||||
$tabs = wpsc_settings_tabs();
|
||||
|
||||
if ( !empty( $tabs ) ) {
|
||||
echo '<div id="wpsc_settings_nav_bar" style="width:100%;">';
|
||||
echo "<ul id='sidemenu' >\n";
|
||||
|
||||
if ( isset( $redir_tab ) && array_key_exists( $redir_tab, $tabs ) ) {
|
||||
$current = $redir_tab;
|
||||
} elseif ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $tabs ) ) {
|
||||
$current = $_GET['tab'];
|
||||
} else {
|
||||
$keys = array_keys( $tabs );
|
||||
$current = array_shift( $keys );
|
||||
}
|
||||
|
||||
foreach ( $tabs as $callback => $text ) {
|
||||
$class = '';
|
||||
|
||||
if ( $current == $callback )
|
||||
$class = " class='current'";
|
||||
|
||||
$href = add_query_arg( array( 'tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false ) );
|
||||
$href = remove_query_arg( 'isocode', $href );
|
||||
$href = wp_nonce_url( $href, "tab-$callback" );
|
||||
$link = "<a href='" . esc_url( $href ) . "'$class>$text</a>";
|
||||
|
||||
echo "\t<li id='" . esc_attr( "tab-$callback" ) . "'>$link</li>\n";
|
||||
}
|
||||
|
||||
echo "</ul>\n";
|
||||
echo '</div>';
|
||||
echo "<div style='clear:both;'></div>";
|
||||
}
|
||||
}
|
||||
|
||||
function country_list( $selected_country = null ) {
|
||||
global $wpdb;
|
||||
|
||||
$output = '';
|
||||
$output .= "<option value=''></option>";
|
||||
$country_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
|
||||
|
||||
foreach ( (array)$country_data as $country ) {
|
||||
$selected = '';
|
||||
|
||||
if ( $selected_country == $country['isocode'] )
|
||||
$selected = "selected='selected'";
|
||||
|
||||
$output .= "<option value='" . $country['isocode'] . "' $selected>" . htmlspecialchars( $country['country'] ) . "</option>";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Shipping Form for wp-admin
|
||||
*/
|
||||
function wpsc_get_shipping_form( $shippingname ) {
|
||||
global $wpsc_shipping_modules;
|
||||
|
||||
if ( array_key_exists( $shippingname, $wpsc_shipping_modules ) ) {
|
||||
$shipping_forms = $wpsc_shipping_modules[$shippingname]->getForm();
|
||||
$shipping_module_name = $wpsc_shipping_modules[$shippingname]->name;
|
||||
$output = array( 'name' => $shipping_module_name, 'form_fields' => $shipping_forms, 'has_submit_button' => 1 );
|
||||
} else {
|
||||
$output = array( 'name' => ' ', 'form_fields' => __( 'To configure a shipping module select one on the left.', 'wpsc' ), 'has_submit_button' => 0 );
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/***
|
||||
* Get Payment Form for wp-admin
|
||||
*/
|
||||
function wpsc_get_payment_form( $paymentname ,$selected_gateway_data='') {
|
||||
global $nzshpcrt_gateways;
|
||||
|
||||
$payment_gateway_names = get_option('payment_gateway_names');
|
||||
$form = array();
|
||||
$output = array( 'name' => ' ', 'form_fields' => __( 'To configure a payment module select one on the left.', 'wpsc' ), 'has_submit_button' => 0 );
|
||||
|
||||
foreach ( $nzshpcrt_gateways as $gateway ) {
|
||||
if ( $gateway["internalname"] != $paymentname ) {
|
||||
continue;
|
||||
} else {
|
||||
$selected_gateway_data = $gateway;
|
||||
$form = $gateway;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $form ) {
|
||||
$output ='';
|
||||
$output .="<tr>
|
||||
<td style='border-top: none;'>
|
||||
".__("Display Name", 'wpsc')."
|
||||
</td>
|
||||
<td style='border-top: none;'>";
|
||||
|
||||
if (isset($payment_gateway_names[$paymentname]) ) {
|
||||
$display_name = $payment_gateway_names[$paymentname];
|
||||
} elseif(!empty($selected_gateway_data['display_name'])){
|
||||
$display_name =$selected_gateway_data['display_name'];
|
||||
}else{
|
||||
switch($selected_gateway_data['payment_type']) {
|
||||
case "paypal";
|
||||
$display_name = "PayPal";
|
||||
break;
|
||||
|
||||
case "manual_payment":
|
||||
$display_name = "Manual Payment";
|
||||
break;
|
||||
|
||||
case "google_checkout":
|
||||
$display_name = "Google Checkout";
|
||||
break;
|
||||
|
||||
case "credit_card":
|
||||
default:
|
||||
$display_name = "Credit Card";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$output .="<input type='text' name='user_defined_name[".$paymentname."]' value='". $display_name ."' /><br />
|
||||
<span class='small description'>".__('The text that people see when making a purchase', 'wpsc')."</span>
|
||||
</td>
|
||||
</tr>";
|
||||
$payment_forms = $form["form"]();
|
||||
$payment_module_name = $form["name"];
|
||||
|
||||
$output = array( 'name' => $payment_module_name, 'form_fields' => $output.$payment_forms, 'has_submit_button' => 1 );
|
||||
} else {
|
||||
$output = array( 'name' => ' ', 'form_fields' => __( 'To configure a payment module select one on the left.', 'wpsc' ), 'has_submit_button' => 0 );
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function wpsc_settings_page_update_notification() {
|
||||
|
||||
if ( isset( $_GET['skipped'] ) || isset( $_GET['updated'] ) || isset( $_GET['regenerate'] ) || isset( $_GET['deleted'] ) || isset( $_GET['shipadd'] ) ) { ?>
|
||||
|
||||
<div id="message" class="updated fade"><p>
|
||||
<?php
|
||||
|
||||
if ( isset( $_GET['updated'] ) && (int)$_GET['updated'] ) {
|
||||
printf( _n( '%s Setting options updated.', ' %s Settings options updated.', $_GET['updated'] ), absint( $_GET['updated'] ) );
|
||||
unset( $_GET['updated'] );
|
||||
$message = true;
|
||||
}
|
||||
if ( isset( $_GET['deleted'] ) && (int)$_GET['deleted'] ) {
|
||||
printf( _n( '%s Setting option deleted.', '%s Setting option deleted.', $_GET['deleted'] ), absint( $_GET['deleted'] ) );
|
||||
unset( $_GET['deleted'] );
|
||||
$message = true;
|
||||
}
|
||||
if ( isset( $_GET['shipadd'] ) && (int)$_GET['shipadd'] ) {
|
||||
printf( _n( '%s Shipping option updated.', '%s Shipping option updated.', $_GET['shipadd'] ), absint( $_GET['shipadd'] ) );
|
||||
unset( $_GET['shipadd'] );
|
||||
$message = true;
|
||||
}
|
||||
if ( isset( $_GET['added'] ) && (int)$_GET['added'] ) {
|
||||
printf( _n( '%s Checkout field added.', '%s Checkout fields added.', $_GET['added'] ), absint( $_GET['added'] ) );
|
||||
unset( $_GET['added'] );
|
||||
$message = true;
|
||||
}
|
||||
if ( isset( $_GET['regenerate'] ) ) {
|
||||
_e('Thumbnails regenerated.', 'wpsc');
|
||||
unset( $_GET['regenerate'] );
|
||||
$message = true;
|
||||
wpsc_regenerate_thumbnails();
|
||||
}
|
||||
|
||||
if ( !isset( $message ) )
|
||||
_e( 'Settings successfully updated.', 'wpsc' );
|
||||
|
||||
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'regenerate', 'skipped', 'updated', 'deleted', 'wpsc_downloadcsv', 'rss_key', 'start_timestamp', 'end_timestamp', 'email_buyer_id' ), $_SERVER['REQUEST_URI'] ); ?>
|
||||
</p></div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,613 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WP eCommerce edit and view sales page functions
|
||||
*
|
||||
* These are the main WPSC sales page functions
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.7
|
||||
*/
|
||||
global $purchlogs;
|
||||
if(!isset($purchlogs)){
|
||||
$purchlogs = new wpsc_purchaselogs();
|
||||
}
|
||||
|
||||
function wpsc_display_sales_logs() {
|
||||
$subpage = empty( $_GET['subpage'] ) ? '' : $_GET['subpage'];
|
||||
|
||||
switch( $subpage ) {
|
||||
case 'upgrade-purchase-logs':
|
||||
wpsc_upgrade_purchase_logs();
|
||||
break;
|
||||
|
||||
case 'update-purchase-logs-3.8':
|
||||
wpsc_update_purchase_logs_3dot8();
|
||||
break;
|
||||
|
||||
default:
|
||||
wpsc_display_sales_log_index();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_update_purchase_logs_3dot8() {
|
||||
if ( _wpsc_purchlogs_need_update() )
|
||||
wpsc_update_purchase_logs();
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php echo esc_html( __('Sales', 'wpsc') ); ?> </h2>
|
||||
<p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.'), remove_query_arg( 'subpage' ) ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function _wpsc_purchlogs_need_update() {
|
||||
global $wpdb;
|
||||
|
||||
if ( get_option( '_wpsc_purchlogs_3.8_updated' ) )
|
||||
return false;
|
||||
|
||||
$c = $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE plugin_version IN ('3.6', '3.7')" );
|
||||
if ( $c > 0 )
|
||||
return true;
|
||||
|
||||
update_option( '_wpsc_purchlogs_3.8_updated', true );
|
||||
return false;
|
||||
}
|
||||
|
||||
function wpsc_display_sales_log_index() {
|
||||
|
||||
global $purchlogitem;
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php echo esc_html( __('Sales', 'wpsc') ); ?> </h2>
|
||||
<?php //START OF PURCHASE LOG DEFAULT VIEW ?>
|
||||
<?php
|
||||
if(isset($_GET['view_purchlogs_by']) || isset($_GET['view_purchlogs_by_status']))
|
||||
wpsc_change_purchlog_view($_GET['view_purchlogs_by'], $_GET['view_purchlogs_by_status']);
|
||||
|
||||
if(isset($_POST['purchlogs_searchbox']))
|
||||
wpsc_search_purchlog_view($_POST['purchlogs_searchbox']);
|
||||
|
||||
if(!isset($_REQUEST['purchaselog_id'])){
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'purchid' => __( 'Order ID', 'wpsc' ),
|
||||
'date' => __( 'Date / Time', 'wpsc' ),
|
||||
'name' => '',
|
||||
'amount' => __( 'Amount', 'wpsc' ),
|
||||
'details' => __( 'Details', 'wpsc' ),
|
||||
'status' => __( 'Status', 'wpsc' ),
|
||||
'delete' => __( 'Delete', 'wpsc' ),
|
||||
'track' => __( 'Tracking ID', 'wpsc' )
|
||||
);
|
||||
register_column_headers('display-sales-list', $columns);
|
||||
///// start of update message section //////
|
||||
|
||||
$fixpage = get_option('siteurl').'/wp-admin/admin.php?page=wpsc-sales-logs&subpage=upgrade-purchase-logs';
|
||||
if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['locked']) ) { ?>
|
||||
<div id="message" class="updated fade"><p>
|
||||
<?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
|
||||
printf( _n( '%s Purchase Log updated.', '%s Purchase Logs updated.', $_GET['updated'], 'wpsc' ), absint( $_GET['updated'] ) );
|
||||
unset($_GET['updated']);
|
||||
}
|
||||
|
||||
if ( isset($_GET['skipped']) && (int) $_GET['skipped'] )
|
||||
unset($_GET['skipped']);
|
||||
|
||||
if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
|
||||
printf( _n( '%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $_GET['locked'], 'wpsc' ), absint( $_GET['locked'] ) );
|
||||
unset($_GET['locked']);
|
||||
}
|
||||
|
||||
if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
|
||||
printf( _n( '%s Purchase Log deleted.', '%s Purchase Logs deleted.', $_GET['deleted'], 'wpsc' ), absint( $_GET['deleted'] ) );
|
||||
unset($_GET['deleted']);
|
||||
}
|
||||
?>
|
||||
</p></div>
|
||||
<?php }
|
||||
|
||||
if(get_option('wpsc_purchaselogs_fixed')== false || (wpsc_check_uniquenames()) ){ ?>
|
||||
<div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __('When upgrading the WP e-Commerce Plugin from 3.6.* to 3.7 it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please <a href="%s">Click Here</a>', 'wpsc'), $fixpage); ?></span></div>
|
||||
<?php }
|
||||
|
||||
if ( _wpsc_purchlogs_need_update() ) {
|
||||
?>
|
||||
<div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __('It has been detected that some of your purchase logs were not updated properly when you upgrade to WP e-Commerce %s. Please <a href="%s">click here</a> to fix this problem.', 'wpsc'), WPSC_VERSION, add_query_arg( 'subpage', 'update-purchase-logs-3.8' ) ); ?></span></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
///// end of update message section //////?>
|
||||
<div id='dashboard-widgets' style='min-width: 825px;'>
|
||||
<?php /* end of sidebar start of main column */ ?>
|
||||
<div id='post-body' class='has-sidebar metabox-holder' style='width:95%;'>
|
||||
<div id='dashboard-widgets-main-content-wpsc' class='has-sidebar-content'>
|
||||
|
||||
<?php
|
||||
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
||||
do_meta_boxes('dashboard_page_wpsc-sales-logs', 'top', true);
|
||||
?>
|
||||
</div><br />
|
||||
<div id='wpsc_purchlog_searchbox'>
|
||||
<?php wpsc_purchaselogs_searchbox(); ?>
|
||||
</div><br />
|
||||
<?php wpsc_purchaselogs_displaylist(); ?>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function(){postboxes.add_postbox_toggles(pagenow);});
|
||||
</script>
|
||||
</div>
|
||||
<?php }else{ //NOT IN GENERIC PURCHASE LOG PAGE, IN DETAILS PAGE PER PURCHASE LOG
|
||||
|
||||
if(isset($_REQUEST['purchaselog_id'])){
|
||||
$purchlogitem = new wpsc_purchaselogs_items((int)$_REQUEST['purchaselog_id']);
|
||||
}
|
||||
if (isset($_GET['cleared']) || isset($_GET['cleared'])) { ?>
|
||||
<div id="message" class="updated fade"><p>
|
||||
<?php
|
||||
if ( isset($_GET['cleared']) && $_GET['cleared']==true ) {
|
||||
_e('Downloads for this log have been released.', 'wpsc' );
|
||||
unset($_GET['cleared']);
|
||||
}
|
||||
if ( isset($_GET['sent']) && (int) $_GET['sent'] ) {
|
||||
_e( 'Receipt has been resent ', 'wpsc' );
|
||||
unset($_GET['sent']);
|
||||
}
|
||||
?> </p></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
$page_back = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted','purchaselog_id'), $_SERVER['REQUEST_URI'] );
|
||||
|
||||
$columns = array(
|
||||
'title' => __('Name','wpsc'),
|
||||
'sku' => __('SKU','wpsc'),
|
||||
'quantity' => __('Quantity','wpsc'),
|
||||
'price' => __('Price','wpsc'),
|
||||
'shipping' => __('Shipping','wpsc'),
|
||||
'tax' => '',
|
||||
'total' => __('Total','wpsc')
|
||||
);
|
||||
|
||||
if(wpec_display_product_tax())
|
||||
{
|
||||
$columns['tax'] = __('Tax Included','wpsc');
|
||||
}// if
|
||||
|
||||
register_column_headers('display-purchaselog-details', $columns);
|
||||
?>
|
||||
<div id='post-body' class='has-sidebar' style='width:95%;'>
|
||||
<?php if(wpsc_has_purchlog_shipping()) { ?>
|
||||
<div id='wpsc_shipping_details_box'>
|
||||
<h3><?php _e('Shipping Address','wpsc'); ?></h3>
|
||||
<p><strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong></p>
|
||||
<p>
|
||||
<?php echo wpsc_display_purchlog_shipping_address(); ?><br />
|
||||
<?php echo wpsc_display_purchlog_shipping_city(); ?><br />
|
||||
<?php echo wpsc_display_purchlog_shipping_state_and_postcode(); ?><br />
|
||||
<?php echo wpsc_display_purchlog_shipping_country(); ?><br />
|
||||
</p>
|
||||
<strong><?php _e('Shipping Options','wpsc'); ?></strong>
|
||||
<p>
|
||||
|
||||
<?php _e('Shipping Method:','wpsc'); ?> <?php echo wpsc_display_purchlog_shipping_method(); ?><br />
|
||||
<?php _e('Shipping Option:','wpsc'); ?> <?php echo wpsc_display_purchlog_shipping_option(); ?><br />
|
||||
<?php if(wpsc_purchlogs_has_tracking()) : ?>
|
||||
<?php _e('Tracking ID:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackid(); ?><br />
|
||||
<?php _e('Shipping Status:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackstatus(); ?><br />
|
||||
<?php _e('Track History:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackhistory(); ?>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div id='wpsc_billing_details_box'>
|
||||
<?php do_action( 'wpsc_billing_details_top'); ?>
|
||||
<h3><?php _e('Billing Details','wpsc'); ?></h3>
|
||||
<p><strong><?php _e('Purchase Log Date:','wpsc'); ?> </strong><?php echo wpsc_purchaselog_details_date(); ?> </p>
|
||||
<p><strong><?php _e('Purchase Number:','wpsc'); ?> </strong><?php echo wpsc_purchaselog_details_purchnumber(); ?> </p>
|
||||
<p><strong><?php _e('Buyers Name:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_buyers_name(); ?></p>
|
||||
<p><strong><?php _e('Address:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_buyers_address(); ?></p>
|
||||
|
||||
<p><strong><?php _e('Phone:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_buyers_phone(); ?></p>
|
||||
<p><strong><?php _e('Email:','wpsc'); ?> </strong><a href="mailto:<?php echo wpsc_display_purchlog_buyers_email(); ?>?subject=Message From '<?php echo get_option('siteurl'); ?>'"><?php echo wpsc_display_purchlog_buyers_email(); ?></a></p>
|
||||
<p><strong><?php _e('Payment Method:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?></p>
|
||||
<?php if(wpsc_display_purchlog_display_howtheyfoundus()) : ?>
|
||||
<p><strong><?php _e('How User Found Us:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php do_action( 'wpsc_billing_details_bottom'); ?>
|
||||
</div>
|
||||
|
||||
<div id='wpsc_items_ordered'>
|
||||
<br />
|
||||
<h3><?php _e('Items Ordered','wpsc'); ?></h3>
|
||||
<table class="widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php print_column_headers('display-purchaselog-details'); ?>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
|
||||
<tbody>
|
||||
<?php wpsc_display_purchlog_details(); ?>
|
||||
<tr> </tr>
|
||||
|
||||
<tr class="wpsc_purchaselog_start_totals">
|
||||
<td colspan="5">
|
||||
<?php if ( wpsc_purchlog_has_discount_data() ) { ?>
|
||||
<?php _e('Coupon Code','wpsc'); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<th><?php _e('Discount','wpsc'); ?> </th>
|
||||
<td><?php echo wpsc_display_purchlog_discount(); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php if(!wpec_display_product_tax()) { ?>
|
||||
<tr>
|
||||
<td colspan='5'></td>
|
||||
<th><?php _e('Taxes','wpsc'); ?> </th>
|
||||
<td><?php echo wpec_display_purchlog_taxes(); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tr>
|
||||
<td colspan='5'></td>
|
||||
<th><?php _e('Shipping','wpsc'); ?> </th>
|
||||
<td><?php echo wpsc_display_purchlog_shipping(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='5'></td>
|
||||
<th><?php _e('Total','wpsc'); ?> </th>
|
||||
<td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id='wpsc_purchlog_order_status'>
|
||||
<form action='' method='post'>
|
||||
<p><label for='<?php echo $_GET['purchaselog_id']; ?>'><?php _e('Order Status:','wpsc'); ?></label><select class='selector' name='<?php echo $_GET['purchaselog_id']; ?>' title='<?php echo $_GET['purchaselog_id']; ?>' >
|
||||
<?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
|
||||
<option value='<?php echo wpsc_the_purch_status_id(); ?>' <?php echo wpsc_purchlog_is_checked_status(); ?> ><?php echo wpsc_the_purch_status_name(); ?> </option>
|
||||
<?php endwhile; ?>
|
||||
</select></p>
|
||||
</form>
|
||||
</div>
|
||||
<br style="clear: both;">
|
||||
<?php wpsc_purchlogs_custom_fields(); ?>
|
||||
|
||||
|
||||
<!-- Start Order Notes (by Ben) -->
|
||||
<?php wpsc_purchlogs_notes(); ?>
|
||||
<!-- End Order Notes (by Ben) -->
|
||||
|
||||
<?php wpsc_custom_checkout_fields(); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id='wpsc_purchlogitems_links'>
|
||||
<h3><?php _e('Actions','wpsc'); ?></h3>
|
||||
<?php do_action( 'wpsc_purchlogitem_links_start' ); ?>
|
||||
<?php if(wpsc_purchlogs_have_downloads_locked() != false): ?>
|
||||
<img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/lock_open.png' alt='clear lock icon' /> <a href='<?php echo $_SERVER['REQUEST_URI'].'&wpsc_admin_action=clear_locks'; ?>'><?php echo wpsc_purchlogs_have_downloads_locked(); ?></a><br /><br class='small' />
|
||||
<?php endif; ?>
|
||||
<img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/printer.png' alt='printer icon' /> <a href='<?php echo add_query_arg('wpsc_admin_action','wpsc_display_invoice'); ?>'><?php _e('View Packing Slip', 'wpsc'); ?></a>
|
||||
|
||||
<br /><br class='small' /><img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/email_go.png' alt='email icon' /> <a href='<?php echo add_query_arg('email_buyer_id',$_GET['purchaselog_id']); ?>'><?php _e('Resend Receipt to Buyer', 'wpsc'); ?></a>
|
||||
|
||||
<br /><br class='small' /><a class='submitdelete' title='<?php echo esc_attr(__( 'Delete this log', 'wpsc' )); ?>' href='<?php echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&purchlog_id=".$_GET['purchaselog_id'], 'delete_purchlog_' .$_GET['purchaselog_id']); ?>' onclick="if ( confirm(' <?php echo esc_js(sprintf( __("You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete.",'wpsc'), wpsc_purchaselog_details_date() )) ?>') ) { return true;}return false;"><img src='<?php echo WPSC_CORE_IMAGES_URL . "/cross.png"; ?>' alt='delete icon' /> <?php _e('Remove this record', 'wpsc') ?></a>
|
||||
|
||||
<br /><br class='small' />   <a href='<?php echo $page_back ?>'><?php _e('Go Back', 'wpsc'); ?></a>
|
||||
<br /><br />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function wpsc_purchaselogs_displaylist(){
|
||||
global $purchlogs;
|
||||
?>
|
||||
<form method='post' action=''>
|
||||
<div class='wpsc_purchaselogs_options'>
|
||||
<select id='purchlog_multiple_status_change' name='purchlog_multiple_status_change' class='purchlog_multiple_status_change'>
|
||||
<option selected='selected' value='-1'><?php _e('Bulk Actions', 'wpsc'); ?></option>
|
||||
<?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
|
||||
<option value='<?php echo wpsc_the_purch_status_id(); ?>' >
|
||||
<?php echo wpsc_the_purch_status_name(); ?>
|
||||
</option>
|
||||
<?php endwhile; ?>
|
||||
<option value="delete"><?php _e('Delete', 'wpsc'); ?></option>
|
||||
</select>
|
||||
<input type='hidden' value='purchlog_bulk_modify' name='wpsc_admin_action2' />
|
||||
<input type="submit" value="<?php _e('Apply', 'wpsc'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||
<?php /* View functions for purchlogs */?>
|
||||
<label for='view_purchlogs_by'><?php _e('View:'); ?></label>
|
||||
|
||||
<select id='view_purchlogs_by' name='view_purchlogs_by'>
|
||||
<?php
|
||||
$date_is_selected['3mnths'] = '';
|
||||
$date_is_selected['all'] = '';
|
||||
if( !isset($_GET['view_purchlogs_by']) )
|
||||
$_GET['view_purchlogs_by'] = '';
|
||||
switch($_GET['view_purchlogs_by']) {
|
||||
case 'all':
|
||||
$date_is_selected['all'] = 'selected="selected"';
|
||||
break;
|
||||
|
||||
default:
|
||||
case '3mnths':
|
||||
case '':
|
||||
$date_is_selected['3mnths'] = 'selected="selected"';
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
<option value='all' <?php echo $date_is_selected['all']; ?>><?php echo _x('All', 'all sales', 'wpsc'); ?></option>
|
||||
<option value='3mnths' <?php echo $date_is_selected['3mnths']; ?>><?php _e('Three Months', 'wpsc'); ?></option>
|
||||
<?php echo wpsc_purchlogs_getfirstdates(); ?>
|
||||
</select>
|
||||
<select id='view_purchlogs_by_status' name='view_purchlogs_by_status'>
|
||||
|
||||
<?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
|
||||
|
||||
<?php
|
||||
|
||||
$current_status = wpsc_the_purch_status_id();
|
||||
$is_selected = '';
|
||||
if(isset($_GET['view_purchlogs_by_status']) && $_GET['view_purchlogs_by_status'] == $current_status) {
|
||||
$is_selected = 'selected="selected"';
|
||||
}
|
||||
?>
|
||||
<option value='<?php echo $current_status; ?>' <?php echo $is_selected; ?> >
|
||||
<?php echo wpsc_the_purch_status_name(); ?>
|
||||
</option>
|
||||
<?php endwhile; ?>
|
||||
<?php if(empty($is_selected)){
|
||||
$is_selected = 'selected="selected"';
|
||||
}else{
|
||||
$is_selected = '';
|
||||
} ?>
|
||||
<option <?php echo $is_selected; ?> value='-1'><?php _e('Status: All', 'wpsc'); ?></option>
|
||||
</select>
|
||||
<input type='hidden' value='purchlog_filter_by' name='wpsc_admin_action' />
|
||||
<input type="submit" value="<?php _e('Filter', 'wpsc'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
|
||||
</div>
|
||||
<?php if( isset( $_POST['purchlogs_searchbox'] ) && wpsc_have_purch_items() == false ): ?>
|
||||
<div class="updated settings-error"><p><?php _e('There are no purchase logs for your selection, please try again.', 'wpsc'); ?></p></div>
|
||||
<?php endif;?>
|
||||
<table class="widefat page fixed" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php print_column_headers('display-sales-list'); ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<?php print_column_headers('display-sales-list', false); ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php get_purchaselogs_content(); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong><?php _e('Total:', 'wpsc'); ?></strong> <?php echo wpsc_currency_display( wpsc_the_purch_total() ); ?></p>
|
||||
<?php
|
||||
if(!isset($purchlogs->current_start_timestamp) && !isset($purchlogs->current_end_timestamp)){
|
||||
$purchlogs->current_start_timestamp = $purchlogs->earliest_timestamp;
|
||||
$purchlogs->current_end_timestamp = $purchlogs->current_timestamp;
|
||||
}
|
||||
$arr_params = array('wpsc_admin_action' => 'wpsc_downloadcsv',
|
||||
'rss_key' => 'key',
|
||||
'start_timestamp' => $purchlogs->current_start_timestamp,
|
||||
'end_timestamp' => $purchlogs->current_end_timestamp);
|
||||
|
||||
$piggy_url = 'http://www.bravenewcode.com/store/plugins/piggy/?utm_source=affiliate-6331&utm_medium=affiliates&utm_campaign=wpec#1';
|
||||
?>
|
||||
<br />
|
||||
<p><a class='admin_download' href='<?php echo htmlentities(add_query_arg($arr_params), ENT_QUOTES, 'UTF-8') ; ?>' ><img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/download.gif' alt='' title='' /> <span> <?php _e('Download CSV', 'wpsc'); ?></span></a>
|
||||
<a target="_blank" class='admin_download' href='<?php echo htmlentities( $piggy_url, ENT_QUOTES, 'UTF-8') ; ?>'><img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/mobile.png' alt='' title='' /> <span> <?php _e('Mobile Sales App', 'wpsc'); ?></span></a></p>
|
||||
</form>
|
||||
<br />
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
(function($){
|
||||
$(document).ready(function(){
|
||||
$('#doaction, #doaction2').click(function(){
|
||||
if ( $('select[name^="purchlog_multiple_status_change"]').val() == 'delete' ) {
|
||||
var m = '<?php echo esc_js(__("You are about to delete the selected purchase logs.\n 'Cancel' to stop, 'OK' to delete.", "wpsc")); ?>';
|
||||
return showNotice.warn(m);
|
||||
}
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
//columns.init('edit');
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
||||
<?php
|
||||
unset($_SESSION['newlogs']);
|
||||
}
|
||||
|
||||
function get_purchaselogs_content(){
|
||||
while(wpsc_have_purch_items()) : wpsc_the_purch_item();
|
||||
?>
|
||||
<tr>
|
||||
<th class="check-column" scope="row"><input type='checkbox' name='purchlogids[]' class='editcheckbox' value='<?php echo wpsc_the_purch_item_id(); ?>' /></th>
|
||||
<td><?php echo wpsc_the_purch_item_id(); ?></td><!-- purchase ID -->
|
||||
<td><?php echo wpsc_the_purch_item_date(); ?></td> <!--Date -->
|
||||
<td><?php echo wpsc_the_purch_item_name(); ?></td> <!--Name/email -->
|
||||
<td><?php echo wpsc_currency_display( wpsc_the_purch_item_price() ); ?></td><!-- Amount -->
|
||||
<td><a href='<?php echo htmlentities(add_query_arg('purchaselog_id', wpsc_the_purch_item_id()), ENT_QUOTES, 'UTF-8') ; ?>'><?php
|
||||
$number_of_items = wpsc_the_purch_item_details();
|
||||
printf( _n( '%s Item', '%s Items', $number_of_items, 'wpsc' ), $number_of_items );
|
||||
?></a></td><!-- Details -->
|
||||
<td>
|
||||
<?php if(!wpsc_purchlogs_is_google_checkout()){ ?>
|
||||
<img src="<?php echo admin_url('images/wpspin_light.gif'); ?>" class="ajax-loading" alt="" style="position:relative; top:3px;" />
|
||||
<select class='selector' name='<?php echo wpsc_the_purch_item_id(); ?>' title='<?php echo wpsc_the_purch_item_id(); ?>' >
|
||||
<?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
|
||||
<option value='<?php echo wpsc_the_purch_status_id(); ?>' <?php echo wpsc_is_checked_status(); ?> ><?php echo wpsc_the_purch_status_name(); ?> </option>
|
||||
<?php endwhile; ?>
|
||||
</select>
|
||||
<?php }else { ?>
|
||||
<a href='http://checkout.google.com/' rel=''><img class='google_checkout_logo' src='<?php echo WPSC_CORE_IMAGES_URL . "/checkout_logo.jpg"; ?>' alt='google checkout' /></a>
|
||||
<?php } ?>
|
||||
</td><!-- Status -->
|
||||
<td><a class='submitdelete' title='<?php echo esc_attr(__('Delete this log', 'wpsc')); ?>' href='<?php echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&purchlog_id=".wpsc_the_purch_item_id(), 'delete_purchlog_' . wpsc_the_purch_item_id()); ?>' onclick="if ( confirm(' <?php echo esc_js(sprintf( __("You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete.", 'wpsc'), wpsc_the_purch_item_date() )) ?>') ) { return true;}return false;"><img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL . "/cross.png"; ?>' alt='delete icon' /></a></td><!-- Delete -->
|
||||
<td>
|
||||
<a class='wpsc_show_trackingid' title='<?php echo wpsc_the_purch_item_id(); ?>' href=''><?php echo wpsc_display_tracking_id(); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='log<?php echo wpsc_the_purch_item_id(); ?> wpsc_trackingid_row'>
|
||||
<td class='wpsc_trackingid_row' colspan='2'>
|
||||
|
||||
<label for='wpsc_trackingid<?php echo wpsc_the_purch_item_id(); ?>'><?php _e('Tracking ID','wpsc');?> :</label>
|
||||
</td>
|
||||
<td class='wpsc_trackingid_row' colspan='2'>
|
||||
<input type='text' name='wpsc_trackingid<?php echo wpsc_the_purch_item_id(); ?>' value='<?php echo wpsc_trackingid_value(); ?>' size='20' />
|
||||
<input type='submit' name='submit' class='button' value='Add Tracking ID' />
|
||||
</td>
|
||||
<td colspan='4'>
|
||||
<img src="<?php echo admin_url('images/wpspin_light.gif'); ?>" class="ajax-loading" alt="" style="position:relative; top:3px;" />
|
||||
<a href='' title='<?php echo wpsc_the_purch_item_id(); ?>' class='sendTrackingEmail'><?php _e( 'Send Custom Message', 'wpsc' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
endwhile;
|
||||
}
|
||||
function wpsc_purchaselogs_searchbox(){
|
||||
?>
|
||||
<form action='' method='post'>
|
||||
<input type='hidden' name='wpsc_admin_action' value='purchlogs_search' />
|
||||
<input type='text' value='<?php if(isset($_POST['purchlogs_searchbox'])) echo $_POST['purchlogs_searchbox']; ?>' name='purchlogs_searchbox' id='purchlogs_searchbox' />
|
||||
<input type="submit" value="<?php _e('Search Logs', 'wpsc'); ?>" class="button-secondary action" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wpsc_display_purchlog_details(){
|
||||
while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item(); ?>
|
||||
<tr>
|
||||
<td><?php echo wpsc_purchaselog_details_name(); ?></td> <!-- NAME! -->
|
||||
<td><?php echo wpsc_purchaselog_details_SKU(); ?></td> <!-- SKU! -->
|
||||
<td><?php echo wpsc_purchaselog_details_quantity(); ?></td> <!-- QUANTITY! -->
|
||||
<td><?php echo wpsc_currency_display( wpsc_purchaselog_details_price() ); ?></td> <!-- PRICE! -->
|
||||
<td><?php echo wpsc_currency_display( wpsc_purchaselog_details_shipping() ); ?></td> <!-- SHIPPING! -->
|
||||
<td><?php if(wpec_display_product_tax()) { echo wpsc_currency_display(wpsc_purchaselog_details_tax()); } ?></td> <!-- TAX! -->
|
||||
<!-- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_discount() ); ?></td> --> <!-- DISCOUNT! -->
|
||||
<td><?php echo wpsc_currency_display( wpsc_purchaselog_details_total() ); ?></td> <!-- TOTAL! -->
|
||||
</tr>
|
||||
<?php
|
||||
endwhile;
|
||||
}
|
||||
|
||||
function wpsc_purchlogs_custom_fields(){
|
||||
if(wpsc_purchlogs_has_customfields()){?>
|
||||
<div class='metabox-holder'>
|
||||
<div id='purchlogs_customfields' class='postbox'>
|
||||
<h3 class='hndle'><?php _e( 'Users Custom Fields' , 'wpsc' ); ?></h3>
|
||||
<div class='inside'>
|
||||
<?php $messages = wpsc_purchlogs_custommessages(); ?>
|
||||
<?php $files = wpsc_purchlogs_customfiles(); ?>
|
||||
<?php if(count($files) > 0){ ?>
|
||||
<h4><?php _e( 'Cart Items with Custom Files' , 'wpsc' ); ?>:</h4>
|
||||
<?php
|
||||
foreach($files as $file){
|
||||
echo $file;
|
||||
}
|
||||
}?>
|
||||
<?php if(count($messages) > 0){ ?>
|
||||
<h4><?php _e( 'Cart Items with Custom Messages' , 'wpsc' ); ?>:</h4>
|
||||
<?php
|
||||
foreach($messages as $message){
|
||||
echo $message;
|
||||
}
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Start Order Notes (by Ben) */
|
||||
function wpsc_purchlogs_notes() {
|
||||
|
||||
if ( true ) { // Need to check if notes column exists in DB and plugin version? ?>
|
||||
<div class="metabox-holder">
|
||||
<div id="purchlogs_notes" class="postbox">
|
||||
<h3 class='hndle'><?php _e( 'Order Notes' , 'wpsc' ); ?></h3>
|
||||
<div class='inside'>
|
||||
<form method="post" action="">
|
||||
<input type='hidden' name='wpsc_admin_action' value='purchlogs_update_notes' />
|
||||
<input type="hidden" name="wpsc_purchlogs_update_notes_nonce" id="wpsc_purchlogs_update_notes_nonce" value="<?php echo wp_create_nonce( 'wpsc_purchlogs_update_notes' ); ?>" />
|
||||
<input type='hidden' name='purchlog_id' value='<?php echo $_GET['purchaselog_id']; ?>' />
|
||||
<p><textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;"><?php if ( isset($_POST['purchlog_notes']) ) { echo stripslashes($_POST['purchlog_notes']); } else { echo wpsc_display_purchlog_notes(); } ?></textarea></p>
|
||||
<p><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wpsc' ); ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
}
|
||||
/* End Order Notes (by Ben) */
|
||||
function wpsc_custom_checkout_fields(){
|
||||
global $purchlogitem;
|
||||
if(!empty($purchlogitem->customcheckoutfields)){
|
||||
?>
|
||||
<div class="metabox-holder">
|
||||
<div id="custom_checkout_fields" class="postbox">
|
||||
<h3 class='hndle'><?php _e( 'Additional Checkout Fields' , 'wpsc' ); ?></h3>
|
||||
<div class='inside'>
|
||||
<?php
|
||||
foreach((array)$purchlogitem->customcheckoutfields as $key=>$value){
|
||||
$value['value'] = maybe_unserialize($value['value']);
|
||||
if(is_array($value['value'])){
|
||||
?>
|
||||
<p><strong><?php echo $key; ?> :</strong> <?php echo implode(stripslashse($value['value']), ','); ?></p>
|
||||
<?php
|
||||
|
||||
|
||||
}else{
|
||||
?>
|
||||
<p><strong><?php echo $key; ?> :</strong> <?php echo stripslashes($value['value']); ?></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: determines whether or not to display the product tax or not
|
||||
* @return: boolean
|
||||
**/
|
||||
function wpec_display_product_tax()
|
||||
{
|
||||
global $purchlogitem;
|
||||
return ($purchlogitem->extrainfo->wpec_taxes_total == 0.00) ? true : false;
|
||||
}// wpec_display_product_tax
|
||||
|
||||
function wpsc_upgrade_purchase_logs() {
|
||||
include(WPSC_FILE_PATH.'/wpsc-admin/includes/purchlogs_upgrade.php');
|
||||
}
|
||||
?>
|
||||
@ -1,119 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WP eCommerce database updating page functions
|
||||
*
|
||||
* These are the main WPSC Admin functions
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.8
|
||||
*/
|
||||
|
||||
global $wpdb,$wp_version;
|
||||
$show_update_page = 1;
|
||||
|
||||
// if there's nothing in the children variation cache, refresh it, just to make sure.
|
||||
if ( 0 == count( get_option( 'wpsc-variation_children' ) ) ) {
|
||||
delete_option( 'wpsc-variation_children' );
|
||||
_get_term_hierarchy( 'wpsc-variation' );
|
||||
}
|
||||
|
||||
// if there's nothing in the children variation cache, refresh it, just to make sure.
|
||||
if ( 0 == count( get_option( 'wpsc_product_category_children' ) ) ) {
|
||||
delete_option( 'wpsc_product_category_children' );
|
||||
_get_term_hierarchy( 'wpsc_product_category_children' );
|
||||
}
|
||||
|
||||
$wpsc_version = get_option( 'wpsc_version', '0' );
|
||||
|
||||
// If database is already updated, then no need to update
|
||||
if ( ! get_option( 'wpsc_needs_update', false ) ) {
|
||||
$show_update_page = 0;
|
||||
} else {
|
||||
|
||||
$table_exists = $wpdb->get_var( "SHOW TABLES LIKE '" . WPSC_TABLE_PRODUCT_LIST . "'" );
|
||||
$product_count = empty( $table_exists ) ? 0 : $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PRODUCT_LIST );
|
||||
|
||||
if ( $product_count > 0 ) {
|
||||
|
||||
function wpsc_display_update_notice() {
|
||||
echo "<div id='wpsc-warning' class='error fade'><p><strong>" . __( 'WP e-Commerce is almost ready.', 'wpsc' ) . "</strong> " . sprintf( __( 'You must <a href="%1$s">update your database</a> to import all of your products.', 'wpsc' ), "admin.php?page=wpsc-update") . "</p></div>";
|
||||
}
|
||||
|
||||
if ( ! isset( $_GET['page'] ) || $_GET['page'] != 'wpsc-update' )
|
||||
add_action( 'admin_notices', 'wpsc_display_update_notice' );
|
||||
|
||||
// There weren't any products, so mark the update as complete
|
||||
} else {
|
||||
update_option( 'wpsc_version', WPSC_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( PHP_VERSION, '5.0.0', '<' ) ) {
|
||||
add_action( 'admin_notices', 'wpsc_display_php_version_notice' );
|
||||
}
|
||||
|
||||
function wpsc_display_php_version_notice() {
|
||||
?>
|
||||
<div id='wpsc-warning' class='error fade'><p><?php printf( __( "You are using PHP %s. WP e-Commerce %s requires PHP 5.0 or above. Please contact your hosting provider for further assistance." ), PHP_VERSION, WPSC_VERSION ); ?></p></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wpsc_display_update_page() {
|
||||
global $wpdb;
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php echo esc_html( __('Update WP e-Commerce', 'wpsc') ); ?> </h2>
|
||||
<br />
|
||||
<?php
|
||||
if ( isset( $_REQUEST['run_updates'] ) ) :
|
||||
ob_implicit_flush( true );
|
||||
$wpsc_update = WPSC_Update::get_instance();
|
||||
$update_stages = array(
|
||||
'convert_category_groups' => __( 'Updating Categories...' , 'wpsc' ),
|
||||
'convert_variation_sets' => __( 'Updating Variations...' , 'wpsc' ),
|
||||
'convert_products_to_posts' => __( 'Updating Products ...' , 'wpsc' ),
|
||||
'convert_variation_combinations' => __( 'Updating Child Products...', 'wpsc' ),
|
||||
'update_files' => __( 'Updating Product Files...' , 'wpsc' ),
|
||||
'update_purchase_logs' => __( 'Updating Purchase Logs... ', 'wpsc' ),
|
||||
'create_or_update_tables' => __( 'Updating Database...' , 'wpsc' ),
|
||||
'update_database' => '',
|
||||
);
|
||||
|
||||
foreach ( $update_stages as $function => $message ) {
|
||||
$wpsc_update->run( $function, $message );
|
||||
}
|
||||
|
||||
echo '<br /><br /><strong>' . __('WP e-Commerce updated successfully!', 'wpsc') . '</strong><br />';
|
||||
if( '' != get_option('permalink_structure')){ ?>
|
||||
<em><?php printf(__('Note: It looks like you have custom permalinks, you will need to refresh your permalinks <a href="%s">here</a>','wpsc' ) , admin_url('options-permalink.php') ); ?></em>
|
||||
<?php
|
||||
}
|
||||
update_option('wpsc_version', 3.8);
|
||||
update_option('wpsc_hide_update', true);
|
||||
update_option( 'wpsc_needs_update', false );
|
||||
$wpsc_update->clean_up();
|
||||
ob_implicit_flush( false );
|
||||
else:
|
||||
|
||||
|
||||
_e('Your WP e-Commerce database needs to be updated for WP e-Commerce 3.8. To perform this update, press the button below. It is highly recommended that you back up your database before performing this update.','wpsc');
|
||||
?> <br />
|
||||
<br />
|
||||
<em><?php _e('Note: If the server times out or runs out of memory, just reload this page, the server will pick up where it left off.','wpsc'); ?></em>
|
||||
<br />
|
||||
|
||||
<form action="" method="post" id="setup">
|
||||
<input type="hidden" name="run_updates" value="true" id="run_updates">
|
||||
<p class="step"><input type="submit" class="button" value="Update WP e-Commerce" name="Submit"></p>
|
||||
</form>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,170 +0,0 @@
|
||||
<?php
|
||||
|
||||
function wpsc_display_upgrades_page() {
|
||||
|
||||
do_action( 'wpsc_gold_module_activation' ); ?>
|
||||
|
||||
<div class='wrap'>
|
||||
<div class='metabox-holder wpsc_gold_side'>
|
||||
<strong><?php _e( 'WP e-Commerce Upgrades', 'wpsc' ); ?></strong><br />
|
||||
<span><?php _e( 'Add more functionality to your e-Commerce site. Prices may be subject to change.', 'wpsc' ); ?><input type='button' class='button-primary' onclick='window.open ("http://getshopped.org/extend/premium-upgrades/","mywindow"); ' value='Buy Now' id='visitInstinct' name='visitInstinct' /></span>
|
||||
|
||||
<br />
|
||||
<div class='wpsc_gold_module'>
|
||||
<br />
|
||||
<a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/gold-cart-plugin/" target="_blank"><strong><?php _e( 'Gold Cart', 'wpsc' ); ?></strong></a>
|
||||
<p class='wpsc_gold_text'>Add product search, multiple image upload, gallery view, Grid View and multiple payment gateway options to your shop</p>
|
||||
<span class='wpsc_gold_info'>$40</span>
|
||||
</div>
|
||||
|
||||
<div class='wpsc_gold_module'>
|
||||
<br />
|
||||
<a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/dropshop-2010/" target="_blank"><strong><?php _e( 'DropShop', 'wpsc' ); ?></strong></a>
|
||||
<p class='wpsc_gold_text'>Impress your customers with our AJAX powered DropShop that lets your customers drag and drop products into their shopping cart</p>
|
||||
<span class='wpsc_gold_info'>$100</span>
|
||||
</div>
|
||||
|
||||
<div class='wpsc_gold_module'>
|
||||
<br />
|
||||
<a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/member-access-plugin/" target="_blank"><strong><?php _e( 'Members Access Plugin', 'wpsc' ); ?></strong></a>
|
||||
<p class='wpsc_gold_text'>Create product memberships and sell them in your store. Use these memberships to restrict premium content on your posts and pages creating a "members only" area perfect for: Forums, Images and Movies and Podcasts</p>
|
||||
<span class='wpsc_gold_info'>$49</span>
|
||||
</div>
|
||||
|
||||
<div class='wpsc_gold_module'>
|
||||
<br />
|
||||
<a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/product-slider-2010/" target="_blank"><strong><?php _e( 'Product Slider', 'wpsc' ); ?> </strong></a>
|
||||
<p class='wpsc_gold_text'>Display your products in a new and fancy way using the "Product Slider" module.</p>
|
||||
<span class='wpsc_gold_info'>$45</span>
|
||||
</div>
|
||||
|
||||
<div class='wpsc_gold_module'>
|
||||
<br />
|
||||
<a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/nextgen-gallery-buy-now1/" target="_blank"><strong><?php _e( 'NextGen Gallery Buy Now Buttons', 'wpsc' ); ?> </strong></a>
|
||||
<p class='wpsc_gold_text'>Make your Online photo gallery into an e-Commerce solution.</p>
|
||||
<span class='wpsc_gold_info'>$10</span>
|
||||
</div>
|
||||
|
||||
<div class='wpsc_gold_module'>
|
||||
<br />
|
||||
<a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/jplayer-mp3-player/" target="_blank"><strong><?php _e( 'JPlayer - MP3 Plugin', 'wpsc' ); ?> </strong></a>
|
||||
<p class='wpsc_gold_text'>JPlayer is a Plugin that provides a Javascript powered MP3 player to each product. This is very similar to our alternative MP3 Player except that it uses CSS and Javascript to customize the look and feel of the player making it much easier for you to style it also comes with a range of skins.</p>
|
||||
<span class='wpsc_gold_info'>$40</span>
|
||||
</div>
|
||||
<div class='wpsc_gold_module'>
|
||||
<br />
|
||||
<a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/fedex-shipping-module/" target="_blank"><strong><?php _e( 'FedEx Plugin', 'wpsc' ); ?> </strong></a>
|
||||
<p class='wpsc_gold_text'>This plugin offers shop owners the ability to provide Fedex Shipping Quotes for products with weights..</p>
|
||||
<span class='wpsc_gold_info'>$40</span>
|
||||
</div>
|
||||
<div class='wpsc_gold_module'>
|
||||
<br />
|
||||
<a href="http://www.bravenewcode.com/store/plugins/piggy/?utm_source=affiliate-6331&utm_medium=affiliates&utm_campaign=wpec" target="_blank"><strong><?php _e( 'Piggy', 'wpsc' ); ?> </strong></a>
|
||||
<p class='wpsc_gold_text'>Your WP E-Commerce sales, in your pocket. Piggy is a web-app that provides mobile access to view sales data for your WP E-Commerce powered WordPress website. Works on iOS and Android.</p>
|
||||
<span class='wpsc_gold_info'>$39</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<h2><?php _e( 'Upgrades', 'wpsc' ); ?></h2>
|
||||
<div class='wpsc_gold_float'>
|
||||
<p><?php _e( 'Enter your API Username and API Key below.', 'wpsc' ); ?></p>
|
||||
<p><a href="http://getshopped.org/resources/docs/installation/gold-files/"><?php _e( 'For more information visit our documentation page.', 'wpsc' ); ?></a></p>
|
||||
|
||||
<div class='metabox-holder'>
|
||||
<form method='post' id='gold_cart_form' action=''>
|
||||
|
||||
<?php
|
||||
if ( defined( 'WPSC_GOLD_MODULE_PRESENT' ) && ( true == WPSC_GOLD_MODULE_PRESENT ) ) {
|
||||
do_action( 'wpsc_gold_module_activation_forms' );
|
||||
} else {
|
||||
?>
|
||||
|
||||
<div id='wpsc_gold_options_outside'>
|
||||
<div class='form-wrap' >
|
||||
<p>
|
||||
<?php _e( "You don't have any Upgrades yet!", 'wpsc' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2><?php _e( 'API Key Reset', 'wpsc' ); ?></h2>
|
||||
<div class='form-wrap' >
|
||||
<p>
|
||||
<?php _e( 'Enter your API name and key to release it from an old site that you no longer use.', 'wpsc' ); ?> <br /><br />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='postbox'>
|
||||
<h3 class='hndle'><?php _e( 'API Key Reset', 'wpsc' ); ?></h3>
|
||||
<p>
|
||||
<label for='activation_name'><?php _e( 'Name:', 'wpsc' ); ?></label>
|
||||
<input class='text' type='text' size='40' value='<?php echo get_option( 'activation_name' ); ?>' name='activation_name' id='activation_name' />
|
||||
</p>
|
||||
<p>
|
||||
<label for='activation_key'><?php _e( 'API Key:', 'wpsc' ); ?></label>
|
||||
<input class='text' type='text' size='40' value='<?php echo get_option( 'activation_key' ); ?>' name='activation_key' id='activation_key' />
|
||||
</p>
|
||||
<p>
|
||||
<input type='hidden' value='true' name='reset_api_key' />
|
||||
<input type='submit' class='button-primary' value='<?php _e( 'Reset API Key', 'wpsc' ); ?>' name='submit_values' />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
function wpsc_reset_api_key() {
|
||||
if ( isset( $_POST['reset_api_key'] ) && ( $_POST['reset_api_key'] == 'true' ) ) {
|
||||
if ( $_POST['activation_name'] != null ) {
|
||||
$target = "http://instinct.co.nz/wp-goldcart-api/api_register.php?name=" . $_POST['activation_name'] . "&key=" . $_POST['activation_key'] . "&url=" . get_option( 'siteurl' ) . "";
|
||||
|
||||
$remote_access_fail = false;
|
||||
$useragent = 'WP e-Commerce plugin';
|
||||
|
||||
$activation_name = urlencode( $_POST['activation_name'] );
|
||||
$activation_key = urlencode( $_POST['activation_key'] );
|
||||
$activation_state = update_option( 'activation_state', "false" );
|
||||
|
||||
$siteurl = urlencode( get_option( 'siteurl' ) );
|
||||
$request = '';
|
||||
|
||||
$http_request = "GET /wp-goldcart-api/api_register.php?name=$activation_name&key=&url=$siteurl HTTP/1.0\r\n";
|
||||
$http_request .= "Host: instinct.co.nz\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option( 'blog_charset' ) . "\r\n";
|
||||
$http_request .= "Content-Length: " . strlen( $request ) . "\r\n";
|
||||
$http_request .= "User-Agent: $useragent\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $request;
|
||||
|
||||
$response = '';
|
||||
|
||||
if ( false != ( $fs = @fsockopen( 'instinct.co.nz', 80, $errno, $errstr, 10 ) ) ) {
|
||||
fwrite( $fs, $http_request );
|
||||
|
||||
while ( !feof( $fs ) )
|
||||
$response .= fgets( $fs, 1160 ); // One TCP-IP packet
|
||||
|
||||
fclose( $fs );
|
||||
}
|
||||
|
||||
$response = explode( "\r\n\r\n", $response, 2 );
|
||||
$returned_value = (int)trim( $response[1] );
|
||||
|
||||
update_option( 'activation_name', '' );
|
||||
update_option( 'activation_key', '' );
|
||||
|
||||
echo "<div class='updated'><p align='center'>" . __( 'Your API key has been Reset', 'wpsc' ) . "</p></div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wpsc_gold_module_activation', 'wpsc_reset_api_key' );
|
||||
|
||||
?>
|
||||
@ -1,407 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WP eCommerce product page functions
|
||||
*
|
||||
* These are the main WPSC Admin functions
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.8
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* wpsc_product_rows function, copies the functionality of the wordpress code for displaying posts and pages, but is for products
|
||||
*
|
||||
*/
|
||||
function wpsc_admin_product_listing($parent_product = null) {
|
||||
global $wp_query, $wpsc_products;
|
||||
add_filter('the_title','esc_html');
|
||||
$args = array_merge( $wp_query->query, array( 'posts_per_page' => '-1' ) );
|
||||
$wpsc_temp_query = query_posts( $args );
|
||||
if ( empty($wpsc_products) )
|
||||
$wpsc_products = &$wpsc_temp_query;
|
||||
|
||||
foreach ( (array)$wpsc_products as $product ) {
|
||||
wpsc_product_row($product, $parent_product);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the -trash status in the product row of manage products page
|
||||
* @access public
|
||||
*
|
||||
* @since 3.8
|
||||
* @param $post_status (array) of current posts statuses
|
||||
* @return $post_status (array)
|
||||
*/
|
||||
function wpsc_trashed_post_status($post_status){
|
||||
$post = get_post(get_the_ID());
|
||||
if( !empty($post) && 'wpsc-product' == $post->post_type && 'trash' == $post->post_status && !in_array('trash', $post_status))
|
||||
$post_status[] = 'Trash';
|
||||
|
||||
return $post_status;
|
||||
}
|
||||
add_filter('display_post_states','wpsc_trashed_post_status');
|
||||
|
||||
/**
|
||||
* Spits out the current products details in a table row for manage products page and variations on edit product page.
|
||||
* @access public
|
||||
*
|
||||
* @since 3.8
|
||||
* @param $product (Object), $parent_product (Int) Note: I believe parent_product is unused
|
||||
*/
|
||||
function wpsc_product_row(&$product, $parent_product = null) {
|
||||
global $mode, $current_user;
|
||||
|
||||
//is this good practice? <v.bakaitis@gmail.com>
|
||||
static $rowclass;
|
||||
|
||||
$global_product = $product;
|
||||
setup_postdata($product);
|
||||
$product_post_type_object = get_post_type_object('wpsc-product');
|
||||
$current_user_can_edit_this_product = current_user_can( $product_post_type_object->cap->edit_post, $product->ID );
|
||||
|
||||
$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
|
||||
$post_owner = ( $current_user->ID == $product->post_author ? 'self' : 'other' );
|
||||
$edit_link = get_edit_post_link( $product->ID );
|
||||
|
||||
$title = get_the_title( $product->ID );
|
||||
|
||||
if ( empty( $title ) )
|
||||
$title = __('(no title)', 'wpsc');
|
||||
|
||||
?>
|
||||
|
||||
<tr id='post-<?php echo $product->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $product->post_status ); ?> iedit <?php if ( get_option ( 'wpsc_sort_by' ) == 'dragndrop') { echo 'product-edit'; } ?>' valign="top">
|
||||
<?php
|
||||
$posts_columns = get_column_headers( 'wpsc-product_variants' );
|
||||
|
||||
if(empty($posts_columns))
|
||||
$posts_columns = array('image' => '', 'title' => __('Name', 'wpsc') , 'weight' => __('Weight', 'wpsc'), 'stock' => __('Stock', 'wpsc'), 'price' => __('Price', 'wpsc'), 'sale_price' => __('Sale Price', 'wpsc'), 'SKU' => __('SKU', 'wpsc'), 'hidden_alerts' => '');
|
||||
|
||||
foreach ( $posts_columns as $column_name=>$column_display_name ) {
|
||||
$class = "class=\"$column_name column-$column_name\"";
|
||||
|
||||
$attributes = "$class";
|
||||
|
||||
switch ($column_name) {
|
||||
|
||||
case 'date': /* !date case */
|
||||
if ( '0000-00-00 00:00:00' == $product->post_date && 'date' == $column_name ) {
|
||||
$t_time = $h_time = __('Unpublished', 'wpsc');
|
||||
$time_diff = 0;
|
||||
} else {
|
||||
$t_time = get_the_time(__('Y/m/d g:i:s A', 'wpsc'));
|
||||
$m_time = $product->post_date;
|
||||
$time = get_post_time('G', true, $post);
|
||||
|
||||
$time_diff = time() - $time;
|
||||
|
||||
if ( $time_diff > 0 && $time_diff < 24*60*60 )
|
||||
$h_time = sprintf( __('%s ago', 'wpsc'), human_time_diff( $time ) );
|
||||
else
|
||||
$h_time = mysql2date(__('Y/m/d', 'wpsc'), $m_time);
|
||||
}
|
||||
|
||||
echo '<td ' . $attributes . '>';
|
||||
if ( 'excerpt' == $mode )
|
||||
echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
|
||||
else
|
||||
echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
|
||||
echo '<br />';
|
||||
if ( 'publish' == $product->post_status ) {
|
||||
_e('Published', 'wpsc');
|
||||
} elseif ( 'future' == $product->post_status ) {
|
||||
if ( $time_diff > 0 )
|
||||
echo '<strong class="attention">' . __('Missed schedule', 'wpsc') . '</strong>';
|
||||
else
|
||||
_e('Scheduled', 'wpsc');
|
||||
} else {
|
||||
_e('Last Modified', 'wpsc');
|
||||
}
|
||||
echo '</td>';
|
||||
break;
|
||||
|
||||
case 'title': /* !title case */
|
||||
$attributes = 'class="post-title column-title"';
|
||||
|
||||
$edit_link = wp_nonce_url( $edit_link, 'edit-product_'.$product->ID );
|
||||
?>
|
||||
<td <?php echo $attributes ?>>
|
||||
<strong>
|
||||
<?php if ( $current_user_can_edit_this_product && $product->post_status != 'trash' ) { ?>
|
||||
<a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”', 'wpsc'), $title)); ?>"><?php echo $title ?></a>
|
||||
<?php if($parent_product): ?>
|
||||
<input type="hidden" class="wpsc_ie_id wpsc_ie_field" value="<?php echo $product->ID ?>">
|
||||
<input type="text" class="wpsc_ie_title wpsc_ie_field" value="<?php echo $title ?>">
|
||||
<div class="wpsc_inline_actions"><input type="button" class="button-primary wpsc_ie_save" value="Save"><img src="<?php bloginfo('url') ?>/wp-admin/images/wpspin_light.gif" class="loading_indicator"><br/><input type="button" class="button-secondary cancel wpsc_ie_cancel" value="<?php _e('Cancel', 'wpsc'); ?>"></div>
|
||||
<?php endif; ?>
|
||||
<?php } else {
|
||||
echo $title;
|
||||
};
|
||||
|
||||
_post_states($product);
|
||||
$product_alert = apply_filters('wpsc_product_alert', array(false, ''), $product);
|
||||
if(!empty($product_alert['messages']))
|
||||
$product_alert['messages'] = implode("\n",(array)$product_alert['messages']);
|
||||
|
||||
if($product_alert['state'] === true) {
|
||||
?>
|
||||
<img alt='<?php echo $product_alert['messages'];?>' title='<?php echo $product_alert['messages'];?>' class='product-alert-image' src='<?php echo WPSC_CORE_IMAGES_URL;?>/product-alert.jpg' alt='' />
|
||||
<?php
|
||||
}
|
||||
|
||||
// If a product alert has stuff to display, show it.
|
||||
// Can be used to add extra icons etc
|
||||
if ( !empty( $product_alert['display'] ) ) {
|
||||
echo $product_alert['display'];
|
||||
}
|
||||
|
||||
?>
|
||||
</strong>
|
||||
<?php
|
||||
$has_var = '';
|
||||
if(wpsc_product_has_children($product->ID))
|
||||
$has_var = 'wpsc_has_variation';
|
||||
$actions = array();
|
||||
if ( $current_user_can_edit_this_product && 'trash' != $product->post_status ) {
|
||||
$actions['edit'] = '<a class="edit-product" href="'.$edit_link.'" title="' . esc_attr(__('Edit this product', 'wpsc')) . '">'. __('Edit', 'wpsc') . '</a>';
|
||||
$actions['quick_edit'] = "<a class='wpsc_editinline ".$has_var."' title='".esc_attr(__('Quick Edit', 'wpsc'))."' href='#'>".__('Quick Edit', 'wpsc')."</a>";
|
||||
}
|
||||
|
||||
if ( in_array($product->post_status, array('pending', 'draft')) ) {
|
||||
if ( $current_user_can_edit_this_product ) {
|
||||
$actions['view'] = '<a href="'.get_permalink($product->ID).'" title="'.esc_attr(sprintf(__('Preview “%s”', 'wpsc'), $title)) . '" rel="permalink">'.__('Preview', 'wpsc').'</a>';
|
||||
}
|
||||
} else if ( 'trash' != $product->post_status ) {
|
||||
$actions['view'] = '<a href="'.get_permalink($product->ID).'" title="'.esc_attr(sprintf(__('View “%s”', 'wpsc'), $title)).'" rel="permalink">'.__('View', 'wpsc').'</a>';
|
||||
}
|
||||
|
||||
$actions = apply_filters('post_row_actions', $actions, $product);
|
||||
$action_count = count($actions);
|
||||
$i = 0;
|
||||
echo '<div class="row-actions">';
|
||||
|
||||
foreach ( $actions as $action => $link ) {
|
||||
++$i;
|
||||
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
|
||||
echo "<span class='$action'>$link$sep</span>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
get_inline_data($product);
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'image': /* !image case */
|
||||
?>
|
||||
<td class="product-image ">
|
||||
<?php
|
||||
$attached_images = (array)get_posts(array(
|
||||
'post_type' => 'attachment',
|
||||
'numberposts' => 1,
|
||||
'post_status' => null,
|
||||
'post_parent' => $product->ID,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
));
|
||||
|
||||
|
||||
|
||||
if(isset($product->ID) && has_post_thumbnail($product->ID)){
|
||||
echo get_the_post_thumbnail($product->ID, 'admin-product-thumbnails');
|
||||
}elseif(!empty($attached_images)){
|
||||
$attached_image = $attached_images[0];
|
||||
|
||||
$src =wp_get_attachment_url($attached_image->ID);
|
||||
?>
|
||||
<div style='width:38px;height:38px;overflow:hidden;'>
|
||||
<img title='Drag to a new position' src='<?php echo $src; ?>' alt='<?php echo $title; ?>' width='38' height='38' />
|
||||
</div>
|
||||
<?php
|
||||
|
||||
|
||||
}else{
|
||||
$image_url = WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif";
|
||||
?>
|
||||
<img title='Drag to a new position' src='<?php echo $image_url; ?>' alt='<?php echo $title; ?>' width='38' height='38' />
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'price': /* !price case */
|
||||
|
||||
$price = get_product_meta($product->ID, 'price', true);
|
||||
?>
|
||||
<td <?php echo $attributes ?>>
|
||||
<?php echo wpsc_currency_display( $price ); ?>
|
||||
<input type="text" class="wpsc_ie_field wpsc_ie_price" value="<?php echo $price; ?>">
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'weight' :
|
||||
|
||||
$product_data['meta'] = array();
|
||||
$product_data['meta'] = get_post_meta($product->ID, '');
|
||||
foreach($product_data['meta'] as $meta_name => $meta_value) {
|
||||
$product_data['meta'][$meta_name] = maybe_unserialize(array_pop($meta_value));
|
||||
}
|
||||
$product_data['transformed'] = array();
|
||||
if(!isset($product_data['meta']['_wpsc_product_metadata']['weight'])) $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
|
||||
if(!isset($product_data['meta']['_wpsc_product_metadata']['weight_unit'])) $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
|
||||
|
||||
$product_data['transformed']['weight'] = wpsc_convert_weight($product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'], false);
|
||||
$weight = $product_data['transformed']['weight'];
|
||||
if($weight == ''){
|
||||
$weight = '0';
|
||||
}
|
||||
?>
|
||||
<td <?php echo $attributes ?>>
|
||||
<span><?php echo $weight; ?></span>
|
||||
<input type="text" class="wpsc_ie_field wpsc_ie_weight" value="<?php echo $weight; ?>">
|
||||
</td>
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
||||
case 'stock' :
|
||||
$stock = get_post_meta($product->ID, '_wpsc_stock', true);
|
||||
?>
|
||||
<td <?php echo $attributes ?>>
|
||||
<span><?php echo $stock ? $stock : __('N/A', 'wpsc') ; ?></span>
|
||||
<input type="text" class="wpsc_ie_field wpsc_ie_stock" value="<?php echo $stock; ?>">
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'categories': /* !categories case */
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php
|
||||
$categories = get_the_product_category($product->ID);
|
||||
if ( !empty( $categories ) ) {
|
||||
$out = array();
|
||||
foreach ( $categories as $c )
|
||||
$out[] = "<a href='admin.php?page=wpsc-edit-products&category={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
|
||||
echo join( ', ', $out );
|
||||
} else {
|
||||
_e('Uncategorized', 'wpsc');
|
||||
}
|
||||
?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'tags': /* !tags case */
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php
|
||||
$tags = get_the_tags($product->ID);
|
||||
if ( !empty( $tags ) ) {
|
||||
$out = array();
|
||||
foreach ( $tags as $c )
|
||||
$out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
|
||||
echo join( ', ', $out );
|
||||
} else {
|
||||
_e('No Tags', 'wpsc');
|
||||
}
|
||||
?></td>
|
||||
<?php
|
||||
break;
|
||||
case 'SKU':
|
||||
$sku = get_post_meta($product->ID, '_wpsc_sku', true);
|
||||
?>
|
||||
<td <?php echo $attributes ?>>
|
||||
<span><?php echo $sku ? $sku : __('N/A', 'wpsc'); ?></span>
|
||||
<input type="text" class="wpsc_ie_field wpsc_ie_sku" value="<?php echo $sku; ?>">
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'sale_price':
|
||||
|
||||
$price = get_post_meta($product->ID, '_wpsc_special_price', true);
|
||||
?>
|
||||
<td <?php echo $attributes ?>>
|
||||
<span><?php echo wpsc_currency_display( $price ); ?></span>
|
||||
<input type="text" class="wpsc_ie_field wpsc_ie_special_price" value="<?php echo $price; ?>">
|
||||
</td>
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'comments': /* !comments case */
|
||||
?>
|
||||
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
|
||||
<?php
|
||||
$pending_phrase = sprintf( __('%s pending', 'wpsc'), number_format( $pending_comments ) );
|
||||
if ( $pending_comments )
|
||||
echo '<strong>';
|
||||
comments_number("<a href='edit-comments.php?p=$product->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count', 'wpsc') . '</span></a>', "<a href='edit-comments.php?p=$product->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count', 'wpsc') . '</span></a>', "<a href='edit-comments.php?p=$product->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count', 'wpsc') . '</span></a>');
|
||||
if ( $pending_comments )
|
||||
echo '</strong>';
|
||||
?>
|
||||
</div></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'author': /* !author case */
|
||||
?>
|
||||
<td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
case 'control_view': /* !control view case */
|
||||
?>
|
||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View', 'wpsc'); ?></a></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'control_edit': /* !control edit case */
|
||||
?>
|
||||
<td><?php if ( $current_user_can_edit_this_product ) { echo "<a href='$edit_link' class='edit'>" . __('Edit', 'wpsc') . "</a>"; } ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'control_delete': /* !control delete case */
|
||||
?>
|
||||
<td><?php if ( $current_user_can_edit_this_product ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $product->ID) . "' class='delete'>" . __('Delete', 'wpsc') . "</a>"; } ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'featured': /* !control featured case */
|
||||
?>
|
||||
<td><?php do_action('manage_posts_featured_column', $product->ID); ?></td>
|
||||
<?php
|
||||
break;
|
||||
default: /* !default case */
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php do_action('manage_posts_custom_column', $column_name, $product->ID); ?></td>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
$product = $global_product;
|
||||
}
|
||||
@ -1,103 +0,0 @@
|
||||
<?php
|
||||
global $wpdb;
|
||||
$numChanged = 0;
|
||||
$numQueries = 0;
|
||||
$purchlog = "SELECT DISTINCT id FROM `".WPSC_TABLE_PURCHASE_LOGS."` LIMIT 1";
|
||||
$id = $wpdb->get_var($purchlog);
|
||||
$usersql = "SELECT DISTINCT `".WPSC_TABLE_SUBMITED_FORM_DATA."`.value, `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` LEFT JOIN `".WPSC_TABLE_SUBMITED_FORM_DATA."` ON `".WPSC_TABLE_CHECKOUT_FORMS."`.id = `".WPSC_TABLE_SUBMITED_FORM_DATA."`.`form_id` WHERE `".WPSC_TABLE_SUBMITED_FORM_DATA."`.log_id=".$id." ORDER BY `".WPSC_TABLE_CHECKOUT_FORMS."`.`checkout_order`" ;
|
||||
$formfields = $wpdb->get_results($usersql);
|
||||
|
||||
|
||||
|
||||
if(count($formfields) < 1){
|
||||
$usersql = "SELECT DISTINCT `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` != 'heading'";
|
||||
$formfields = $wpdb->get_results($usersql);
|
||||
|
||||
}
|
||||
if(isset($_POST)){
|
||||
foreach($_POST as $key=>$value){
|
||||
if($value != '-1'){
|
||||
$sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='".$value."' WHERE id=".$key;
|
||||
$complete = $wpdb->query($sql);
|
||||
}
|
||||
$numChaged++;
|
||||
$numQueries ++;
|
||||
}
|
||||
|
||||
$sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'";
|
||||
$wpdb->query($sql);
|
||||
|
||||
add_option('wpsc_purchaselogs_fixed',true);
|
||||
}
|
||||
function wpsc_select_options_purchlogs_fix($id){
|
||||
?>
|
||||
<select name='<?php echo $id; ?>'>
|
||||
<option value='-1'><?php _e( 'Select an Option', 'wpsc' ); ?>'</option>
|
||||
<option value='billingfirstname'><?php _e( 'Billing First Name', 'wpsc' ); ?></option>
|
||||
<option value='billinglastname'><?php _e( 'Billing Last Name', 'wpsc' ); ?></option>
|
||||
<option value='billingaddress'><?php _e( 'Billing Address', 'wpsc' ); ?></option>
|
||||
<option value='billingcity'><?php _e( 'Billing City', 'wpsc' ); ?></option>
|
||||
<option value='billingstate'><?php _e( 'Billing State', 'wpsc' ); ?></option>
|
||||
<option value='billingcountry'><?php _e( 'Billing Country', 'wpsc' ); ?></option>
|
||||
<option value='billingemail'><?php _e( 'Billing Email', 'wpsc' ); ?></option>
|
||||
<option value='billingphone'><?php _e( 'Billing Phone', 'wpsc' ); ?></option>
|
||||
<option value='billingpostcode'><?php _e( 'Billing Post Code', 'wpsc' ); ?></option>
|
||||
<option value='shippingfirstname'><?php _e( 'Shipping First Name', 'wpsc' ); ?></option>
|
||||
<option value='shippinglastname'><?php _e( 'Shipping Last Name', 'wpsc' ); ?></option>
|
||||
<option value='shippingaddress'><?php _e( 'Shipping Address', 'wpsc' ); ?></option>
|
||||
<option value='shippingcity'><?php _e( 'Shipping City', 'wpsc' ); ?></option>
|
||||
<option value='shippingstate'><?php _e( 'Shipping State', 'wpsc' ); ?></option>
|
||||
<option value='shippingcountry'><?php _e( 'Shipping Country', 'wpsc' ); ?></option>
|
||||
<option value='shippingpostcode'><?php _e( 'Shipping Post Code', 'wpsc' ); ?></option>
|
||||
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class='wrap'>
|
||||
|
||||
<?php if ( $numChanged != 0 && $numQueries != 0 ) {
|
||||
echo '<div id="message" class="updated fade"><p>';
|
||||
_e( 'Check Out Form Fields updated.', 'wpsc' );
|
||||
echo '</p></div>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h2><?php echo esc_html( __('Sales Upgrade Fix', 'wpsc') ); ?> </h2>
|
||||
<p><?php _e('Upgrading to WP e-Commerce 3.7 and later requires you to run this fix once.The following Boxes corresponds to the form fields in your current checkout page. All you have to do is select from the drop-down menu box what each of the following fields represent. Sorry for any inconvenience caused, but we\'re sure you\'ll agree that the new purchase logs are worth this minor hassle.', 'wpsc'); ?> </p>
|
||||
|
||||
<div class="metabox-holder" style="width:700px">
|
||||
<form action='' method='post'>
|
||||
|
||||
<?php
|
||||
|
||||
$duplicate = array();
|
||||
foreach($formfields as $fields){
|
||||
if(!in_array($fields->name,$duplicate) && $fields->name != 'State'){
|
||||
echo '<div class="postbox" style="width:70%">';
|
||||
echo '<h3 class="handle">Billing '.$fields->name.'</h3>';
|
||||
echo '<div class="inside" style="padding:20px;">';
|
||||
echo '<label style="width:120px;float:left;" for="'.$fields->id.'">'.$fields->value.'</label>';
|
||||
echo wpsc_select_options_purchlogs_fix($fields->id);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
$duplicate[] = $fields->name;
|
||||
}else{
|
||||
echo '<div class="postbox" style="width:70%">';
|
||||
echo '<h3 class="handle">Shipping '.$fields->name.'</h3>';
|
||||
echo '<div class="inside" style="padding:20px;">';
|
||||
echo '<label style="width:120px;float:left;" for="'.$fields->id.'">'.$fields->value.'</label>';
|
||||
echo wpsc_select_options_purchlogs_fix($fields->id);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
<input type='submit' value='<?php _e('Apply', 'wpsc'); ?>' class='button-secondary action' />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,646 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file used for adding fields to the products category taxonomy page and saving those values correctly :)
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.8
|
||||
* @todo UI needs a lot of loving - lots of padding issues, if we have these boxes, they should be sortable, closable, hidable, etc.
|
||||
*/
|
||||
|
||||
/**
|
||||
* WP eCommerce edit and add product category page functions
|
||||
*
|
||||
* These are the main WPSC Admin functions
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.7
|
||||
*/
|
||||
|
||||
function wpsc_ajax_set_category_order(){
|
||||
global $wpdb;
|
||||
$sort_order = $_POST['sort_order'];
|
||||
$parent_id = $_POST['parent_id'];
|
||||
|
||||
$result = true;
|
||||
foreach( $sort_order as $key=>$value ){
|
||||
if( !wpsc_update_meta( $value, 'sort_order', $key, 'wpsc_category' ) )
|
||||
$result = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the AJAX response on the categories page. Necessary for allowing for image upload.
|
||||
* @param nothing
|
||||
* @return nothing
|
||||
*/
|
||||
|
||||
function wpsc_cat_kill_ajax() {
|
||||
global $current_screen;
|
||||
|
||||
if( $current_screen->id == 'edit-wpsc_product_category' ) {
|
||||
wp_deregister_script( 'wp-ajax-response' );
|
||||
wp_deregister_script( 'admin-tags' );
|
||||
wp_deregister_script( 'inline-edit-post' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_head', 'wpsc_cat_kill_ajax' );
|
||||
add_filter( 'manage_edit-wpsc_product_category_columns', 'wpsc_custom_category_columns' );
|
||||
add_filter( 'manage_wpsc_product_category_custom_column', 'wpsc_custom_category_column_data', 10, 3);
|
||||
add_action( 'wpsc_product_category_add_form_fields', 'wpsc_admin_category_forms_add' ); // After left-col
|
||||
add_action( 'wpsc_product_category_edit_form_fields', 'wpsc_admin_category_forms_edit' ); // After left-col
|
||||
add_action( 'created_wpsc_product_category', 'wpsc_save_category_set', 10 , 2 ); //After created
|
||||
add_action( 'edited_wpsc_product_category', 'wpsc_save_category_set', 10 , 2 ); //After saved
|
||||
|
||||
/**
|
||||
* wpsc_custom_category_columns
|
||||
* Adds images column to category column.
|
||||
* @internal Don't feel handle column is necessary, but you would add it here if you wanted to
|
||||
* @param (array) columns | Array of columns assigned to this taxonomy
|
||||
* @return (array) columns | Modified array of columns
|
||||
*/
|
||||
|
||||
function wpsc_custom_category_columns( $columns ) {
|
||||
// Doing it this funny way to ensure that image stays in far left, even if other items are added via plugin.
|
||||
unset( $columns["cb"] );
|
||||
|
||||
$custom_array = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'image' => __( 'Image', 'wpsc' )
|
||||
);
|
||||
|
||||
$columns = array_merge( $custom_array, $columns );
|
||||
|
||||
return $columns;
|
||||
}
|
||||
/**
|
||||
* wpsc_custom_category_column_data
|
||||
* Adds images to the custom category column
|
||||
* @param (array) column_name | column name
|
||||
* @return nada
|
||||
*/
|
||||
|
||||
function wpsc_custom_category_column_data( $string, $column_name, $term_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$image = wpsc_get_categorymeta( $term_id, 'image' );
|
||||
$name = get_term_by( 'id', $term_id, 'wpsc_product_category' );
|
||||
$name = $name->name;
|
||||
|
||||
if( !empty( $image ) )
|
||||
$image = "<img src=\"".WPSC_CATEGORY_URL.stripslashes( $image )."\" title='".$name."' alt='".$name."' width='30' height='30' />";
|
||||
else
|
||||
$image = "<img src='".WPSC_CORE_IMAGES_URL."/no-image-uploaded.gif' title='".$name."' alt='".$name."' width='30' height='30' />";
|
||||
|
||||
|
||||
return $image;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_admin_get_category_array
|
||||
* Recursively step through the categories and return it in a clean multi demensional array
|
||||
* for use in other list functions
|
||||
* @param int $parent_id
|
||||
*/
|
||||
function wpsc_admin_get_category_array($parent_id = null){
|
||||
global $wpdb;
|
||||
$orderedList = array();
|
||||
if(!isset($parent_id)) $parent_id = 0;
|
||||
$category_list = get_terms('wpsc_product_category','hide_empty=0&parent='.$parent_id);
|
||||
if(!is_array($category_list)){
|
||||
return false;
|
||||
}
|
||||
foreach($category_list as $category){
|
||||
$category_order = wpsc_get_categorymeta($category->term_id, 'order');
|
||||
$category_image = wpsc_get_categorymeta($category->term_id, 'image');
|
||||
if(!isset($category_order) || $category_order == 0) $category_order = (count($orderedList) +1);
|
||||
print "<!-- setting category Order number to ".$category_order."-->";
|
||||
$orderedList[$category_order]['id'] = $category->term_id;
|
||||
$orderedList[$category_order]['name'] = $category->name;
|
||||
$orderedList[$category_order]['image'] = $category_image;
|
||||
$orderedList[$category_order]['parent_id'] = $parent_id;
|
||||
$orderedList[$category_order]['children'] = wpsc_admin_get_category_array($category->term_id);
|
||||
}
|
||||
|
||||
ksort($orderedList);
|
||||
return($orderedList);
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_admin_category_group_list, prints the left hand side of the add categories page
|
||||
* nothing returned
|
||||
*/
|
||||
function wpsc_admin_category_forms_add() {
|
||||
global $wpdb;
|
||||
$category_value_count = 0;
|
||||
?>
|
||||
|
||||
<h3><?php _e('Advanced Settings', 'wpsc'); ?></h3>
|
||||
|
||||
<div id="poststuff" class="postbox">
|
||||
<h3 class="hndle"><?php _e('Presentation Settings', 'wpsc'); ?></h3>
|
||||
|
||||
<div class="inside">
|
||||
<tr>
|
||||
<td>
|
||||
<label for='image'><?php _e( 'Category Image' , 'wpsc' ); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type='file' name='image' value='' /><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php _e('Catalog View', 'wpsc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if (!isset($category['display_type'])) $category['display_type'] = '';
|
||||
|
||||
if ($category['display_type'] == 'grid') {
|
||||
$display_type1="selected='selected'";
|
||||
} else if ($category['display_type'] == 'default') {
|
||||
$display_type2="selected='selected'";
|
||||
}
|
||||
|
||||
switch($category['display_type']) {
|
||||
case "default":
|
||||
$category_view1 = "selected ='selected'";
|
||||
break;
|
||||
|
||||
case "grid":
|
||||
if(function_exists('product_display_grid')) {
|
||||
$category_view3 = "selected ='selected'";
|
||||
break;
|
||||
}
|
||||
|
||||
case "list":
|
||||
if(function_exists('product_display_list')) {
|
||||
$category_view2 = "selected ='selected'";
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
$category_view0 = "selected ='selected'";
|
||||
break;
|
||||
}?>
|
||||
|
||||
|
||||
<select name='display_type'>
|
||||
<option value=''<?php echo $category_view0; ?> ><?php _e('Please select', 'wpsc'); ?></option>
|
||||
<option value='default' <?php if (isset($category_view1)) echo $category_view1; ?> ><?php _e('Default View', 'wpsc'); ?></option>
|
||||
|
||||
<?php if(function_exists('product_display_list')) {?>
|
||||
<option value='list' <?php echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
|
||||
<?php } else { ?>
|
||||
<option value='list' disabled='disabled' <?php if (isset($category_view2)) echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
|
||||
<?php } ?>
|
||||
<?php if(function_exists('product_display_grid')) { ?>
|
||||
<option value='grid' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e('Grid View', 'wpsc'); ?></option>
|
||||
<?php } else { ?>
|
||||
<option value='grid' disabled='disabled' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e('Grid View', 'wpsc'); ?></option>
|
||||
<?php } ?>
|
||||
</select><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span class='small'><?php _e('To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc'); ?></span><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if(function_exists("getimagesize")) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php _e('Thumbnail Size', 'wpsc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('Width', 'wpsc'); ?> <input type='text' value='<?php if (isset($category['image_width'])) echo $category['image_width']; ?>' name='image_width' size='6'/>
|
||||
<?php _e('Height', 'wpsc'); ?> <input type='text' value='<?php if (isset($category['image_height'])) echo $category['image_height']; ?>' name='image_height' size='6'/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- START OF TARGET MARKET SELECTION -->
|
||||
<div id="poststuff" class="postbox">
|
||||
<h3 class="hndle"><?php _e('Target Market Restrictions'); ?></h3>
|
||||
<div class="inside"><?php
|
||||
$category_id = '';
|
||||
if (isset($_GET["tag_ID"])) $category_id = $_GET["tag_ID"];
|
||||
$countrylist = $wpdb->get_results("SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A);
|
||||
$selectedCountries = wpsc_get_meta($category_id,'target_market','wpsc_category');
|
||||
$output = '';
|
||||
$output .= " <tr>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
$output .= __('Target Markets', 'wpsc').":\n\r";
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " <td>\n\r";
|
||||
|
||||
if(@extension_loaded('suhosin')) {
|
||||
$output .= "<em>".__("The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature then disable the suhosin extension, if you can not do this, you will need to contact your hosting provider.
|
||||
",'wpsc')."</em>";
|
||||
|
||||
} else {
|
||||
$output .= "<span>Select: <a href='' class='wpsc_select_all'>All</a> <a href='' class='wpsc_select_none'>None</a></span><br />";
|
||||
$output .= " <div id='resizeable' class='ui-widget-content multiple-select'>\n\r";
|
||||
foreach($countrylist as $country){
|
||||
if(in_array($country['id'], (array)$selectedCountries)){
|
||||
$output .= " <input type='checkbox' name='countrylist2[]' value='".$country['id']."' checked='".$country['visible']."' />".$country['country']."<br />\n\r";
|
||||
} else {
|
||||
$output .= " <input type='checkbox' name='countrylist2[]' value='".$country['id']."' />".$country['country']."<br />\n\r";
|
||||
}
|
||||
}
|
||||
$output .= " </div><br /><br />";
|
||||
$output .= " <span class='wpscsmall description'>Select the markets you are selling this category to.<span>\n\r";
|
||||
}
|
||||
$output .= " </td>\n\r";
|
||||
$output .= " </tr>\n\r";
|
||||
|
||||
echo $output;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Checkout settings -->
|
||||
<div id="poststuff" class="postbox">
|
||||
<h3 class="hndle"><?php _e('Checkout Settings', 'wpsc'); ?></h3>
|
||||
<div class="inside">
|
||||
<table class='category_forms'>
|
||||
<?php
|
||||
if (!isset($category['term_id'])) $category['term_id'] = '';
|
||||
$used_additonal_form_set = wpsc_get_categorymeta($category['term_id'], 'use_additonal_form_set'); ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php _e("This category requires additional checkout form fields",'wpsc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<select name='use_additonal_form_set'>
|
||||
<option value=''><?php _e("None",'wpsc'); ?></option>
|
||||
<?php
|
||||
$checkout_sets = get_option('wpsc_checkout_form_sets');
|
||||
unset($checkout_sets[0]);
|
||||
|
||||
foreach((array)$checkout_sets as $key => $value) {
|
||||
$selected_state = "";
|
||||
if($used_additonal_form_set == $key)
|
||||
$selected_state = "selected='selected'";
|
||||
?>
|
||||
<option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo stripslashes($value); ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $uses_billing_address = (bool)wpsc_get_categorymeta($category['term_id'], 'uses_billing_address'); ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php _e("Products in this category use the billing address to calculate shipping",'wpsc'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type='radio' value='1' name='uses_billing_address' <?php echo (($uses_billing_address == true) ? "checked='checked'" : ""); ?> /><?php _e("Yes",'wpsc'); ?>
|
||||
<input type='radio' value='0' name='uses_billing_address' <?php echo (($uses_billing_address != true) ? "checked='checked'" : ""); ?> /><?php _e("No",'wpsc'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="category_forms">
|
||||
<tr>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wpsc_admin_category_forms_edit() {
|
||||
global $wpdb;
|
||||
|
||||
$category_value_count = 0;
|
||||
$category_name = '';
|
||||
$category = array();
|
||||
|
||||
$category_id = absint( $_REQUEST["tag_ID"] );
|
||||
$category = get_term($category_id, 'wpsc_product_category', ARRAY_A);
|
||||
$category['nice-name'] = wpsc_get_categorymeta($category['term_id'], 'nice-name');
|
||||
$category['description'] = wpsc_get_categorymeta($category['term_id'], 'description');
|
||||
$category['image'] = wpsc_get_categorymeta($category['term_id'], 'image');
|
||||
$category['fee'] = wpsc_get_categorymeta($category['term_id'], 'fee');
|
||||
$category['active'] = wpsc_get_categorymeta($category['term_id'], 'active');
|
||||
$category['order'] = wpsc_get_categorymeta($category['term_id'], 'order');
|
||||
$category['display_type'] = wpsc_get_categorymeta($category['term_id'], 'display_type');
|
||||
$category['image_height'] = wpsc_get_categorymeta($category['term_id'], 'image_height');
|
||||
$category['image_width'] = wpsc_get_categorymeta($category['term_id'], 'image_width');
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h3><?php _e( 'Advanced Settings', 'wpsc' ); ?></h3>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="display_type"><?php _e( 'Catalog View', 'wpsc' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
//Could probably be *heavily* refactored later just to use do_action here and in GoldCart. Baby steps.
|
||||
if (!isset($category['display_type'])) $category['display_type'] = '';
|
||||
|
||||
if ($category['display_type'] == 'grid') {
|
||||
$display_type1="selected='selected'";
|
||||
} else if ($category['display_type'] == 'default') {
|
||||
$display_type2="selected='selected'";
|
||||
}
|
||||
|
||||
switch($category['display_type']) {
|
||||
case "default":
|
||||
$category_view1 = "selected ='selected'";
|
||||
break;
|
||||
|
||||
case "grid":
|
||||
if(function_exists('product_display_grid')) {
|
||||
$category_view3 = "selected ='selected'";
|
||||
break;
|
||||
}
|
||||
|
||||
case "list":
|
||||
if(function_exists('product_display_list')) {
|
||||
$category_view2 = "selected ='selected'";
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
$category_view0 = "selected ='selected'";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<select name='display_type'>
|
||||
<option value=''<?php echo $category_view0; ?> ><?php _e('Please select', 'wpsc'); ?></option>
|
||||
<option value='default' <?php if (isset($category_view1)) echo $category_view1; ?> ><?php _e( 'Default View', 'wpsc' ); ?></option>
|
||||
|
||||
<?php if(function_exists('product_display_list')) {?>
|
||||
<option value='list' <?php echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
|
||||
<?php } else { ?>
|
||||
<option value='list' disabled='disabled' <?php if (isset($category_view2)) echo $category_view2; ?>><?php _e( 'List View', 'wpsc' ); ?></option>
|
||||
<?php } ?>
|
||||
<?php if(function_exists('product_display_grid')) { ?>
|
||||
<option value='grid' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
|
||||
<?php } else { ?>
|
||||
<option value='grid' disabled='disabled' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
|
||||
<?php } ?>
|
||||
</select><br />
|
||||
<span class="description"><?php _e( 'To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc' ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="image"><?php _e( 'Category Image', 'wpsc' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type='file' name='image' value='' /><br />
|
||||
<label><input type='checkbox' name='deleteimage' class="wpsc_cat_box" value='1' /><?php _e( 'Delete Image', 'wpsc' ); ?></label><br/>
|
||||
<span class="description"><?php _e( 'You can set an image for the category here. If one exists, check the box to delete.', 'wpsc' ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if( function_exists( "getimagesize" ) ) : ?>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="image"><?php _e( 'Thumbnail Size', 'wpsc' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php _e( 'Width', 'wpsc' ); ?> <input type='text' class="wpsc_cat_image_size" value='<?php if (isset($category['image_width'])) echo $category['image_width']; ?>' name='image_width' size='6' />
|
||||
<?php _e( 'Height', 'wpsc' ); ?> <input type='text' class="wpsc_cat_image_size" value='<?php if (isset($category['image_height'])) echo $category['image_height']; ?>' name='image_height' size='6' /><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; // 'getimagesize' condition ?>
|
||||
<tr>
|
||||
<td colspan="2"><h3><?php _e( 'Shortcodes and Template Tags', 'wpsc' ); ?></h3></td>
|
||||
</tr>
|
||||
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="image"><?php _e( 'Display Category Shortcode', 'wpsc' ); ?>:</label>
|
||||
</th>
|
||||
<td>
|
||||
<span>[wpsc_products category_url_name='<?php echo $category["slug"]; ?>']</span><br />
|
||||
<span class="description"><?php _e( 'Shortcodes are used to display a particular category or group within any WordPress page or post.', 'wpsc' ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="image"><?php _e( 'Display Category Template Tag', 'wpsc' ); ?>:</label>
|
||||
</th>
|
||||
<td>
|
||||
<span><?php echo wpsc_display_products_page( array( 'category_url_name'=>'<?php echo $category["slug"]; ?>' ) ); ?></span><br />
|
||||
<span class="description"><?php _e( 'Template tags are used to display a particular category or group within your theme / template.', 'wpsc' ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- START OF TARGET MARKET SELECTION -->
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h3><?php _e( 'Target Market Restrictions', 'wpsc' ); ?></h3>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$countrylist = $wpdb->get_results( "SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A );
|
||||
$selectedCountries = wpsc_get_meta( $category_id,'target_market','wpsc_category' );
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="image"><?php _e( 'Target Markets', 'wpsc' ); ?>:</label>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
if ( @extension_loaded( 'suhosin' ) ) :
|
||||
?>
|
||||
<em><?php _e( 'The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.','wpsc'); ?></em>
|
||||
|
||||
<?php
|
||||
else :
|
||||
?>
|
||||
<span><?php _e( 'Select', 'wpsc' ); ?>: <a href='' class='wpsc_select_all'><?php _e( 'All', 'wpsc' ); ?></a> <a href='' class='wpsc_select_none'><?php _e( 'None', 'wpsc' ); ?></a></span><br />
|
||||
<div id='resizeable' class='ui-widget-content multiple-select'>
|
||||
<?php
|
||||
foreach( $countrylist as $country ) {
|
||||
if( in_array( $country['id'], (array)$selectedCountries ) )
|
||||
echo " <input type='checkbox' class='wpsc_cat_box' name='countrylist2[]' value='".$country['id']."' checked='".$country['visible']."' />".$country['country']."<br />";
|
||||
else
|
||||
echo " <input type='checkbox' class='wpsc_cat_box' name='countrylist2[]' value='".$country['id']."' />".$country['country']."<br />";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
?><br />
|
||||
<span class="description"><?php _e( 'Select the markets you are selling this category to.', 'wpsc' ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Checkout settings -->
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h3><?php _e( 'Checkout Settings', 'wpsc' ); ?></h3>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ( !isset( $category['term_id'] ) )
|
||||
$category['term_id'] = '';
|
||||
$used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additonal_form_set' );
|
||||
$checkout_sets = get_option('wpsc_checkout_form_sets');
|
||||
unset($checkout_sets[0]);
|
||||
$uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' );
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="image"><?php _e( 'Category requires additional checkout form fields', 'wpsc' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select name='use_additonal_form_set'>
|
||||
<option value=''><?php _e( 'None', 'wpsc' ); ?></option>
|
||||
<?php
|
||||
foreach( (array) $checkout_sets as $key => $value ) {
|
||||
$selected_state = "";
|
||||
if( $used_additonal_form_set == $key )
|
||||
$selected_state = "selected='selected'";
|
||||
?>
|
||||
<option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo stripslashes( $value ); ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select><br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="image"><?php _e( 'Products in this category use the billing address to calculate shipping', 'wpsc' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type='radio' class="wpsc_cat_box" value='1' name='uses_billing_address' <?php echo ( ( $uses_billing_address == true ) ? "checked='checked'" : "" ); ?> /><?php _e( 'Yes','wpsc' ); ?>
|
||||
<input type='radio' class="wpsc_cat_box" value='0' name='uses_billing_address' <?php echo (($uses_billing_address != true) ? "checked='checked'" : ""); ?> /><?php _e( 'No','wpsc' ); ?>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_save_category_set, Saves the category set data
|
||||
* @param nothing
|
||||
* @return nothing
|
||||
*/
|
||||
function wpsc_save_category_set($category_id, $tt_id) {
|
||||
global $wpdb;
|
||||
if( !empty( $_POST ) ) {
|
||||
/* Image Processing Code*/
|
||||
if( !empty( $_FILES['image'] ) && preg_match( "/\.(gif|jp(e)*g|png){1}$/i", $_FILES['image']['name'] ) ) {
|
||||
if( function_exists( "getimagesize" ) ) {
|
||||
if( ( (int) $_POST['width'] > 10 && (int) $_POST['width'] < 512 ) && ((int)$_POST['height'] > 10 && (int)$_POST['height'] < 512) ) {
|
||||
$width = (int) $_POST['width'];
|
||||
$height = (int) $_POST['height'];
|
||||
image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ), $width, $height );
|
||||
} else {
|
||||
image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ) );
|
||||
}
|
||||
$image = $wpdb->escape( $_FILES['image']['name'] );
|
||||
} else {
|
||||
$new_image_path = ( WPSC_CATEGORY_DIR.basename($_FILES['image']['name'] ) );
|
||||
move_uploaded_file( $_FILES['image']['tmp_name'], $new_image_path );
|
||||
$stat = stat( dirname( $new_image_path ) );
|
||||
$perms = $stat['mode'] & 0000666;
|
||||
@ chmod( $new_image_path, $perms );
|
||||
$image = $wpdb->escape( $_FILES['image']['name'] );
|
||||
}
|
||||
} else {
|
||||
$image = '';
|
||||
}
|
||||
//Good to here
|
||||
|
||||
if( isset( $_POST['tag_ID'] ) ) {
|
||||
//Editing
|
||||
$category_id= $_POST['tag_ID'];
|
||||
$category = get_term_by( 'id', $category_id, 'wpsc_product_category' );
|
||||
$url_name=$category->slug;
|
||||
|
||||
}
|
||||
if(isset($_POST['deleteimage']) && $_POST['deleteimage'] == 1) {
|
||||
wpsc_delete_categorymeta($category_id, 'image');
|
||||
} else if($image != '') {
|
||||
wpsc_update_categorymeta($category_id, 'image', $image);
|
||||
}
|
||||
|
||||
if ( !empty( $_POST['height'] ) && is_numeric( $_POST['height'] ) && !empty( $_POST['width'] ) && is_numeric( $_POST['width'] ) && $image == null ) {
|
||||
$imagedata = wpsc_get_categorymeta($category_id, 'image');
|
||||
if($imagedata != null) {
|
||||
$height = $_POST['height'];
|
||||
$width = $_POST['width'];
|
||||
$imagepath = WPSC_CATEGORY_DIR . $imagedata;
|
||||
$image_output = WPSC_CATEGORY_DIR . $imagedata;
|
||||
image_processing($imagepath, $image_output, $width, $height);
|
||||
}
|
||||
}
|
||||
|
||||
wpsc_update_categorymeta($category_id, 'fee', '0');
|
||||
wpsc_update_categorymeta($category_id, 'active', '1');
|
||||
wpsc_update_categorymeta($category_id, 'order', '0');
|
||||
|
||||
if ( isset( $_POST['display_type'] ) )
|
||||
wpsc_update_categorymeta($category_id, 'display_type',$wpdb->escape(stripslashes($_POST['display_type'])));
|
||||
|
||||
if ( isset( $_POST['image_height'] ) )
|
||||
wpsc_update_categorymeta($category_id, 'image_height', $wpdb->escape(stripslashes($_POST['image_height'])));
|
||||
|
||||
if ( isset( $_POST['image_width'] ) )
|
||||
wpsc_update_categorymeta($category_id, 'image_width', $wpdb->escape(stripslashes($_POST['image_width'])));
|
||||
|
||||
|
||||
if ( ! empty( $_POST['use_additional_form_set'] ) ) {
|
||||
wpsc_update_categorymeta($category_id, 'use_additonal_form_set', $_POST['use_additonal_form_set']);
|
||||
} else {
|
||||
wpsc_delete_categorymeta($category_id, 'use_additonal_form_set');
|
||||
}
|
||||
|
||||
if ( ! empty( $_POST['uses_billing_address'] ) ) {
|
||||
wpsc_update_categorymeta($category_id, 'uses_billing_address', 1);
|
||||
$uses_additional_forms = true;
|
||||
} else {
|
||||
wpsc_update_categorymeta($category_id, 'uses_billing_address', 0);
|
||||
$uses_additional_forms = false;
|
||||
}
|
||||
|
||||
if( ! empty( $_POST['countrylist2'] ) && ($category_id > 0)){
|
||||
$AllSelected = false;
|
||||
$countryList = $wpdb->get_col("SELECT `id` FROM `".WPSC_TABLE_CURRENCY_LIST."`");
|
||||
|
||||
if($AllSelected != true){
|
||||
$unselectedCountries = array_diff($countryList, $_POST['countrylist2']);
|
||||
//find the countries that are selected
|
||||
$selectedCountries = array_intersect($countryList, $_POST['countrylist2']);
|
||||
wpsc_update_categorymeta( $category_id, 'target_market', $selectedCountries);
|
||||
}
|
||||
|
||||
} elseif ( ! isset($_POST['countrylist2'] ) ){
|
||||
wpsc_update_categorymeta( $category_id, 'target_market','');
|
||||
$AllSelected = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -1,174 +0,0 @@
|
||||
<?php
|
||||
function wpsc_options_admin(){
|
||||
global $wpdb;
|
||||
?>
|
||||
<form name='cart_options' id='cart_options' method='post' action='' class='wpsc_form_track'>
|
||||
<div id="options_admin">
|
||||
<h3><?php _e('Admin Settings', 'wpsc'); ?></h3>
|
||||
<?php
|
||||
/* wpsc_setting_page_update_notification displays the wordpress styled notifications */
|
||||
wpsc_settings_page_update_notification(); ?>
|
||||
<table class='wpsc_options form-table'>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Max downloads per file', 'wpsc');?>: </th>
|
||||
<td>
|
||||
<input type='text' size='10' value='<?php esc_attr_e( get_option('max_downloads') ); ?>' name='wpsc_options[max_downloads]' />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$wpsc_ip_lock_downloads1 = "";
|
||||
$wpsc_ip_lock_downloads2 = "";
|
||||
switch( esc_attr( get_option('wpsc_ip_lock_downloads') ) ) {
|
||||
case 1:
|
||||
$wpsc_ip_lock_downloads1 = "checked ='checked'";
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
$wpsc_ip_lock_downloads2 = "checked ='checked'";
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e('Lock downloads to IP address', 'wpsc');?>:
|
||||
</th>
|
||||
<td>
|
||||
<input type='radio' value='1' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads2' <?php echo $wpsc_ip_lock_downloads1; ?> /> <label for='wpsc_ip_lock_downloads2'><?php _e('Yes', 'wpsc');?></label>
|
||||
<input type='radio' value='0' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads1' <?php echo $wpsc_ip_lock_downloads2; ?> /> <label for='wpsc_ip_lock_downloads1'><?php _e('No', 'wpsc');?></label><br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php
|
||||
$wpsc_check_mime_types1 = "";
|
||||
$wpsc_check_mime_types2 = "";
|
||||
switch( esc_attr( get_option('wpsc_check_mime_types') ) ) {
|
||||
case 1:
|
||||
$wpsc_check_mime_types2 = "checked ='checked'";
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
$wpsc_check_mime_types1 = "checked ='checked'";
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e('Check MIME types on file uploads', 'wpsc');?>:
|
||||
</th>
|
||||
<td>
|
||||
<input type='radio' value='0' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types2' <?php echo $wpsc_check_mime_types1; ?> /> <label for='wpsc_check_mime_types2'><?php _e('Yes', 'wpsc');?></label>
|
||||
<input type='radio' value='1' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types1' <?php echo $wpsc_check_mime_types2; ?> /> <label for='wpsc_check_mime_types1'><?php _e('No', 'wpsc');?></label><br />
|
||||
|
||||
<span class="wpscsmall description">
|
||||
<?php _e('Warning: Disabling this exposes your site to greater possibility of malicious files being uploaded, we reccomend installing the Fileinfo extention for PHP rather than disabling this.', 'wpsc'); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e('Purchase Log Email', 'wpsc');?>:
|
||||
</th>
|
||||
<td>
|
||||
<input class='text' name='wpsc_options[purch_log_email]' type='text' size='40' value='<?php esc_attr_e( get_option('purch_log_email') ); ?>' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e('Purchase Receipt - Reply Address', 'wpsc');?>:
|
||||
</th>
|
||||
<td>
|
||||
<input class='text' name='wpsc_options[return_email]' type='text' size='40' value='<?php esc_attr_e( get_option('return_email') ); ?>' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e('Purchase Receipt - Reply Name', 'wpsc');?>:
|
||||
</th>
|
||||
<td>
|
||||
<input class='text' name='wpsc_options[return_name]' type='text' size='40' value='<?php esc_attr_e( get_option('return_name') ); ?>' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e('Terms and Conditions', 'wpsc');?>:
|
||||
</th>
|
||||
<td>
|
||||
<textarea name='wpsc_options[terms_and_conditions]' cols='' rows='' style='width: 300px; height: 200px;'><?php esc_attr_e(stripslashes(get_option('terms_and_conditions') ) ); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<h3 class="form_group"><?php _e('Custom Messages', 'wpsc');?>:</h3>
|
||||
<table class='wpsc_options form-table'>
|
||||
<tr>
|
||||
<th colspan="2"><?php _e('Tags can be used', 'wpsc');?>: %purchase_id%, %shop_name%,<!-- %order_status%,--> %product_list%, %total_price%, %total_shipping%, %find_us%, %total_tax%</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='wpsc_td_note' colspan='2'>
|
||||
<span class="wpscsmall description">
|
||||
<?php _e('Note: The purchase receipt is the message e-mailed to users after purchasing products from your shop.' , 'wpsc'); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong><?php _e('Purchase Receipt', 'wpsc');?></strong></th>
|
||||
<td><textarea name="wpsc_options[wpsc_email_receipt]" cols='' rows='' style='width: 300px; height: 200px;'><?php esc_attr_e( stripslashes(get_option('wpsc_email_receipt') ) );?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='wpsc_td_note' colspan='2'>
|
||||
<span class="wpscsmall description">
|
||||
<?php _e('Note: The Admin Report is the email sent to the e-mail address set above as soon as someone successfully buys a product.' , 'wpsc'); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong><?php _e('Admin Report', 'wpsc');?></strong></th>
|
||||
<td><textarea name="wpsc_options[wpsc_email_admin]" cols='' rows='' style='width: 300px; height: 200px;'><?php esc_attr_e( stripslashes(get_option('wpsc_email_admin') ) );?></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3 class="form_group"><?php _e("Track and Trace settings", 'wpsc');?>:</h3>
|
||||
<table class='wpsc_options form-table'>
|
||||
<tr>
|
||||
<td class='wpsc_td_note' colspan='2'>
|
||||
<span class="wpscsmall description">
|
||||
<?php _e('Note: The Tracking Subject, is the subject for The Tracking Message email. The Tracking Message is the message e-mailed to users when you click \'Email buyer\' on the sales log. This option is only available for purchases with the status of \'Job Dispatched\'. Tags you can use in the email message section are %trackid% and %shop_name%' , 'wpsc'); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong><?php _e('Tracking Email Subject', 'wpsc');?></strong></th>
|
||||
<td><input name="wpsc_options[wpsc_trackingid_subject]" type='text' value='<?php esc_attr_e( stripslashes(get_option('wpsc_trackingid_subject') ) );?>' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong><?php _e('Tracking Email Message', 'wpsc');?></strong></th>
|
||||
<td><textarea name="wpsc_options[wpsc_trackingid_message]" cols='' rows='' style='width: 300px; height: 200px;'><?php esc_attr_e( stripslashes(get_option('wpsc_trackingid_message') ) );?></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
/* here end the admin options */
|
||||
?>
|
||||
<?php do_action('wpsc_admin_settings_page'); ?>
|
||||
<div class="submit">
|
||||
<input type='hidden' name='wpsc_admin_action' value='submit_options' />
|
||||
|
||||
<?php wp_nonce_field('update-options', 'wpsc-update-options'); ?>
|
||||
<input type="submit" value="<?php _e('Update »', 'wpsc');?>" name="updateoption"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,233 +0,0 @@
|
||||
<?php
|
||||
function wpsc_options_checkout(){
|
||||
global $wpdb;
|
||||
$form_types = get_option('wpsc_checkout_form_fields');
|
||||
$unique_names = get_option('wpsc_checkout_unique_names');
|
||||
|
||||
do_action('wpsc_checkout_form_fields_page');
|
||||
$columns = array(
|
||||
'drag' => __('Drag', 'wpsc'),
|
||||
'name' => __('Name', 'wpsc'),
|
||||
'type' => __('Type', 'wpsc'),
|
||||
'unique_names' => __('Unique Names', 'wpsc'),
|
||||
'mandatory' => __('Mandatory', 'wpsc'),
|
||||
'trash' => __('Trash', 'wpsc'),
|
||||
);
|
||||
register_column_headers('display-checkout-list', $columns);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<form name='cart_options' id='cart_options' method='post' action='' class='wpsc_form_track'>
|
||||
<div class="wrap">
|
||||
<?php
|
||||
/* wpsc_setting_page_update_notification displays the wordpress styled notifications */
|
||||
wpsc_settings_page_update_notification(); ?>
|
||||
|
||||
<form method='post' action='' id='chekcout_options_tbl' class='wpsc_form_track'>
|
||||
<div class='metabox-holder' style='width:95%;'>
|
||||
<div class='postbox'>
|
||||
<input type='hidden' name='checkout_submits' value='true' />
|
||||
<h3 class='hndle'><?php _e( 'Misc Checkout Options' , 'wpsc' ); ?></h3>
|
||||
<div class='inside'>
|
||||
<table>
|
||||
<tr>
|
||||
<td><?php _e('Users must register before checking out', 'wpsc'); ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
$require_register = esc_attr( get_option('require_register') );
|
||||
$require_register1 = "";
|
||||
$require_register2 = "";
|
||||
switch($require_register) {
|
||||
case 0:
|
||||
$require_register2 = "checked ='checked'";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$require_register1 = "checked ='checked'";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php echo $require_register1; ?> /> <label for='require_register1'><?php _e('Yes', 'wpsc');?></label>
|
||||
<input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php echo $require_register2; ?> /> <label for='require_register2'><?php _e('No', 'wpsc');?></label>
|
||||
</td>
|
||||
<td>
|
||||
<a title='<?php _e('If yes then you must also turn on the wordpress option "Any one can register"', 'wpsc');?>' class='flag_email' href='#' ><img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/help.png' alt='' /> </a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<?php
|
||||
$shippingBilling = get_option('shippingsameasbilling');
|
||||
$shippingBilling1 = $shippingBilling2 = '';
|
||||
switch($shippingBilling) {
|
||||
case 1:
|
||||
$shippingBilling1 = "checked ='checked'";
|
||||
break;
|
||||
|
||||
case 0:
|
||||
$shippingBilling2 = "checked ='checked'";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<td scope="row"><?php _e('Enable Shipping Same as Billing Option: ', 'wpsc'); ?>:</td>
|
||||
<td>
|
||||
<input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php if (!empty($shippingBilling1)) echo $shippingBilling1; ?> />
|
||||
<label for='shippingsameasbilling1'><?php _e('Yes', 'wpsc');?></label>
|
||||
<input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php if (!empty($shippingBilling2)) echo $shippingBilling2; ?> />
|
||||
<label for='shippingsameasbilling2'><?php _e('No', 'wpsc');?></label>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php _e('Force users to use SSL', 'wpsc'); ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
$wpsc_force_ssl = esc_attr( get_option('wpsc_force_ssl') );
|
||||
$wpsc_force_ssl1 = "";
|
||||
$wpsc_force_ssl2 = "";
|
||||
switch($wpsc_force_ssl) {
|
||||
case 0:
|
||||
$wpsc_force_ssl2 = "checked ='checked'";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$wpsc_force_ssl1 = "checked ='checked'";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<input type='radio' value='1' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl1' <?php echo $wpsc_force_ssl1; ?> /> <label for='wpsc_force_ssl1'><?php _e('Yes', 'wpsc');?></label>
|
||||
<input type='radio' value='0' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl2' <?php echo $wpsc_force_ssl2; ?> /> <label for='wpsc_force_ssl2'><?php _e('No', 'wpsc');?></label>
|
||||
</td>
|
||||
<td>
|
||||
<a title='<?php _e('This can cause warnings for your users if you do not have a properly configured SSL certificate', 'wpsc');?>' class='flag_email' href='#' ><img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/help.png' alt='' /> </a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php do_action('wpsc_checkout_settings_page'); ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h3><?php _e('Form Fields', 'wpsc'); ?></h3>
|
||||
<p><?php _e('Here you can customise the forms to be displayed in your checkout page. The checkout page is where you collect important user information that will show up in your purchase logs i.e. the buyers address, and name...', 'wpsc');?></p>
|
||||
|
||||
<p>
|
||||
<label for='wpsc_form_set'><?php _e('Select a Form Set' , 'wpsc'); ?>:</label>
|
||||
<select id='wpsc_form_set' name='wpsc_form_set'>
|
||||
<?php
|
||||
$checkout_sets = get_option('wpsc_checkout_form_sets');
|
||||
foreach((array)$checkout_sets as $key => $value) {
|
||||
$selected_state = "";
|
||||
if(isset($_GET['checkout-set']) && $_GET['checkout-set'] == $key) {
|
||||
$selected_state = "selected='selected'";
|
||||
}
|
||||
echo "<option {$selected_state} value='{$key}'>".esc_attr( stripslashes( $value ) )."</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type='submit' value='Filter' name='wpsc_checkout_set_filter' class='button-secondary' />
|
||||
<a href='#' class='add_new_form_set'><?php _e("+ Add New Form Set", 'wpsc'); ?></a>
|
||||
</p>
|
||||
|
||||
<p class='add_new_form_set_forms'>
|
||||
<label><?php _e("Add new Form Set",'wpsc'); ?>: <input type="text" value="" name="new_form_set" /></label>
|
||||
<input type="submit" value="<?php _e('Add', 'wpsc'); ?>" class="button-secondary" id="formset-add-sumbit"/>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
if(!isset($_GET['checkout-set']) || ($_GET['checkout-set'] == 0)) {
|
||||
$form_sql = "SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1' AND `checkout_set` IN ('0', '') ORDER BY `checkout_order`;";
|
||||
} else {
|
||||
$filter = $wpdb->escape($_GET['checkout-set']);
|
||||
$form_sql = "SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1' AND `checkout_set` IN ('".$filter."') ORDER BY `checkout_order`;";
|
||||
}
|
||||
$email_form_field = $wpdb->get_row("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `checkout_order` ASC LIMIT 1",ARRAY_A);
|
||||
|
||||
|
||||
$form_data = $wpdb->get_results($form_sql,ARRAY_A);
|
||||
if (!isset($_GET['checkout-set'])) $_GET['checkout-set'] = '';
|
||||
|
||||
$selected_checkout_set = esc_attr($_GET['checkout-set']);
|
||||
echo "<input type='hidden' name='selected_form_set' value='".$selected_checkout_set."' />";
|
||||
?>
|
||||
<table id="wpsc_checkout_list" class="widefat page fixed" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php print_column_headers('display-checkout-list'); ?>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<?php print_column_headers('display-checkout-list', false); ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
<tbody id='wpsc_checkout_list_body'>
|
||||
<?php
|
||||
foreach((array)$form_data as $form_field) {
|
||||
echo "<tr id='checkout_".$form_field['id']."' class='checkout_form_field'>\n\r";
|
||||
echo '<td class="drag"><a href="" onclick="return false;" title="' . __('Click and Drag to Order Checkout Fields', 'wpsc') . '"><img src="' . WPSC_CORE_IMAGES_URL . '/roll-over-drag.jpg" alt="roll-over-drag" /></a></td>';
|
||||
echo "<td class='namecol'><input type='text' name='form_name[".$form_field['id']."]' value='".esc_attr(htmlentities(stripslashes($form_field['name']), ENT_QUOTES, "UTF-8"))."' /></td>";
|
||||
|
||||
echo " <td class='typecol'>";
|
||||
echo "<select class='wpsc_checkout_selectboxes' name='form_type[".$form_field['id']."]'>";
|
||||
foreach($form_types as $form_type_name => $form_type) {
|
||||
$selected = '';
|
||||
if($form_type === $form_field['type']) {
|
||||
$selected = "selected='selected'";
|
||||
}
|
||||
echo "<option value='".$form_type."' ".$selected.">" . $form_type_name . "</option>";
|
||||
}
|
||||
|
||||
echo "</select>";
|
||||
if(in_array($form_field['type'], array('select','radio','checkbox'))){
|
||||
echo "<a class='wpsc_edit_checkout_options' rel='form_options[".$form_field['id']."]' href=''>" . __('more options', 'wpsc') . "</a>";
|
||||
}
|
||||
echo "</td>";
|
||||
$checked = "";
|
||||
echo "<td><select name='unique_names[".$form_field['id']."]'>";
|
||||
echo "<option value='-1'>" . __('Select a Unique Name', 'wpsc') . "</option>";
|
||||
foreach($unique_names as $unique_name){
|
||||
$selected = "";
|
||||
if($unique_name == $form_field['unique_name']) {
|
||||
$selected = "selected='selected'";
|
||||
}
|
||||
echo "<option ".$selected." value='".$unique_name."'>".$unique_name."</option>";
|
||||
}
|
||||
echo "</select></td>";
|
||||
if($form_field['mandatory']) {
|
||||
$checked = "checked='checked'";
|
||||
}
|
||||
echo " <td class='mandatorycol'><input $checked type='checkbox' name='form_mandatory[".$form_field['id']."]' value='1' /></td>";
|
||||
|
||||
|
||||
echo " <td><a class='image_link' href='#' onclick='return remove_form_field(\"checkout_".$form_field['id']."\",".$form_field['id'].");'><img src='" . WPSC_CORE_IMAGES_URL . "/trash.gif' alt='".__('Delete', 'wpsc')."' title='".__('Delete', 'wpsc')."' /></a>";
|
||||
|
||||
if($email_form_field['id'] == $form_field['id']) {
|
||||
echo "<a title='".__('This will be the Email address that the Purchase Reciept is sent to.', 'wpsc')."' class='flag_email' href='#' ><img src='" . WPSC_CORE_IMAGES_URL . "/help.png' alt='' /> </a>";
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
echo "
|
||||
</tr>";
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php ?>
|
||||
<p>
|
||||
<input type='hidden' name='wpsc_admin_action' value='checkout_settings' />
|
||||
|
||||
<?php wp_nonce_field('update-options', 'wpsc-update-options'); ?>
|
||||
<input class='button-primary' type='submit' name='submit' value='<?php _e('Save Changes', 'wpsc');?>' />
|
||||
<a href='#' onclick='return add_form_field();'><?php _e('Add New Form Field', 'wpsc');?></a>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@ -1,151 +0,0 @@
|
||||
<?php
|
||||
|
||||
function wpsc_options_gateway() {
|
||||
global $wpdb, $nzshpcrt_gateways;
|
||||
|
||||
$curgateway = get_option( 'payment_gateway' );
|
||||
|
||||
$payment_gateway_names = get_option( 'payment_gateway_names' );
|
||||
|
||||
if ( empty( $nzshpcrt_gateways ) )
|
||||
$nzshpcrt_gateways = nzshpcrt_get_gateways();
|
||||
|
||||
if ( is_array( $nzshpcrt_gateways ) ) {
|
||||
$selected_gateways = get_option( 'custom_gateway_options' );
|
||||
foreach ( $nzshpcrt_gateways as $gateway ) {
|
||||
if ( $gateway['internalname'] == $curgateway ) {
|
||||
$selected = "selected='selected'";
|
||||
$form = $gateway['form']();
|
||||
$selected_gateway_data = $gateway;
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
|
||||
if ( isset( $gateway['admin_name'] ) )
|
||||
$gateway['name'] = $gateway['admin_name'];
|
||||
|
||||
$disabled = '';
|
||||
|
||||
if ( !in_array( $gateway['internalname'], (array)$selected_gateways ) )
|
||||
$disabled = "disabled='disabled'";
|
||||
|
||||
if ( !isset( $gateway['internalname'] ) )
|
||||
$gateway['internalname'] = '';
|
||||
|
||||
$gatewaylist = '';
|
||||
$gatewaylist .= "<option $disabled value='" . esc_attr( $gateway['internalname'] ) . "' " . $selected . " >" . esc_attr( $gateway['name'] ) . "</option>";
|
||||
}
|
||||
}
|
||||
$nogw = '';
|
||||
$gatewaylist = "<option value='" . $nogw . "'>" . __( 'Please Select A Payment Gateway', 'wpsc' ) . "</option>" . $gatewaylist;
|
||||
?>
|
||||
|
||||
<script language='javascript' type='text/javascript'>
|
||||
function selectgateway() {
|
||||
document.forms.gateway_opt.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrap">
|
||||
<div class='metabox-holder'>
|
||||
<form name='gatewayopt' method='post' id='gateway_opt' action='' class='wpsc_form_track'>
|
||||
<input type='hidden' name='gateway_submits' value='true' />
|
||||
<input type='hidden' name='wpsc_gateway_settings' value='gateway_settings' />
|
||||
<?php
|
||||
if ( get_option( 'custom_gateway' ) == 1 ) {
|
||||
$custom_gateway_hide = "style='display:block;'";
|
||||
$custom_gateway1 = 'checked="checked"';
|
||||
} else {
|
||||
$custom_gateway_hide = "style='display:none;'";
|
||||
$custom_gateway2 = 'checked="checked"';
|
||||
}
|
||||
/* wpsc_setting_page_update_notification displays the wordpress styled notifications */
|
||||
wpsc_settings_page_update_notification(); ?>
|
||||
<table id='gateway_options' >
|
||||
<tr>
|
||||
<td class='select_gateway'>
|
||||
<div class='postbox'>
|
||||
<h3 class='hndle'><?php _e( 'General Settings', 'wpsc' ); ?></h3>
|
||||
<div class='inside'>
|
||||
<p><?php _e( 'Activate the payment gateways that you want to make available to your customers by selecting them below.', 'wpsc' ); ?></p>
|
||||
<br />
|
||||
<?php
|
||||
$selected_gateways = get_option( 'custom_gateway_options' );
|
||||
foreach ( $nzshpcrt_gateways as $gateway ) {
|
||||
if ( isset( $gateway['admin_name'] ) )
|
||||
$gateway['name'] = $gateway['admin_name'];
|
||||
|
||||
if ( in_array( $gateway['internalname'], (array)$selected_gateways ) ) {
|
||||
?>
|
||||
|
||||
<div class="wpsc_shipping_options">
|
||||
<div class='wpsc-shipping-actions wpsc-payment-actions'>
|
||||
| <span class="edit">
|
||||
<a class='edit-payment-module' rel="<?php echo $gateway['internalname']; ?>" onclick="event.preventDefault();" title="Edit this Payment Module" href='<?php echo htmlspecialchars( add_query_arg( 'payment_module', $gateway['internalname'] ) ); ?>' style="cursor:pointer;">Edit</a>
|
||||
</span> |
|
||||
</div>
|
||||
<p><input name='wpsc_options[custom_gateway_options][]' checked='checked' type='checkbox' value='<?php esc_attr_e( $gateway['internalname'] ); ?>' id='<?php esc_attr_e( $gateway['internalname'] ); ?>_id' />
|
||||
<label for='<?php esc_attr_e( $gateway['internalname'] ); ?>_id'><?php esc_attr_e( $gateway['name'] ); ?></label></p>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="wpsc_shipping_options">
|
||||
<div class='wpsc-shipping-actions wpsc-payment-actions'>
|
||||
| <span class="edit">
|
||||
<a class='edit-payment-module' rel="<?php echo $gateway['internalname']; ?>" onclick="event.preventDefault();" title="Edit this Payment Module" href='<?php echo htmlspecialchars( add_query_arg( 'payment_module', $gateway['internalname'] ) ); ?>' style="cursor:pointer;"><?php _e( 'Edit' , 'wpsc' ); ?></a>
|
||||
</span> |
|
||||
</div>
|
||||
<p><input name='wpsc_options[custom_gateway_options][]' type='checkbox' value='<?php echo $gateway['internalname']; ?>' id='<?php echo $gateway['internalname']; ?>_id' />
|
||||
<label for='<?php echo $gateway['internalname']; ?>_id'><?php echo $gateway['name']; ?></label></p></div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class='submit gateway_settings'>
|
||||
<input type='hidden' value='true' name='update_gateways' />
|
||||
<input type='submit' value='<?php _e( 'Update »', 'wpsc' ) ?>' name='updateoption' />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><?php _e( 'We Recommend', 'wpsc' ); ?></h4>
|
||||
<a style="border-bottom:none;" href="https://www.paypal.com/nz/mrb/pal=LENKCHY6CU2VY" target="_blank"><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/paypal-referal.gif" border="0" alt="Sign up for PayPal and start accepting credit card payments instantly." /></a> <br /><br />
|
||||
<a style="border-bottom:none;" href="http://checkout.google.com/sell/?promo=seinstinct" target="_blank"><img src="https://checkout.google.com/buyer/images/google_checkout.gif" border="0" alt="Sign up for Google Checkout" /></a>
|
||||
|
||||
</td>
|
||||
|
||||
<td class='gateway_settings' rowspan='2'>
|
||||
<div class='postbox'>
|
||||
<?php
|
||||
|
||||
if ( !isset( $_SESSION['previous_payment_name'] ) )
|
||||
$_SESSION['previous_payment_name'] = "";
|
||||
if ( !isset( $selected_gateway_data ) )
|
||||
$selected_gateway_data = "";
|
||||
$payment_data = wpsc_get_payment_form( $_SESSION['previous_payment_name'], $selected_gateway_data );
|
||||
?>
|
||||
<h3 class='hndle'><?php echo $payment_data['name']; ?></h3>
|
||||
<div class='inside'>
|
||||
<table class='form-table'>
|
||||
<?php echo $payment_data['form_fields']; ?>
|
||||
</table>
|
||||
<?php
|
||||
if ( $payment_data['has_submit_button'] == 0 )
|
||||
$update_button_css = 'style= "display: none;"';
|
||||
else
|
||||
$update_button_css = '';
|
||||
?>
|
||||
<div class='submit' <?php echo $update_button_css; ?>>
|
||||
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
||||
<input type='submit' value='<?php _e( 'Update »', 'wpsc' ) ?>' name='updateoption' />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@ -1,164 +0,0 @@
|
||||
<?php
|
||||
|
||||
function wpsc_options_general() {
|
||||
global $wpdb;
|
||||
?>
|
||||
<form method='post' action='' id='cart_options' name='cart_options' class='wpsc_form_track'>
|
||||
<div id="options_general">
|
||||
<h3><?php _e( 'General Settings', 'wpsc' ); ?></h3>
|
||||
<?php
|
||||
/* wpsc_setting_page_update_notification displays the wordpress styled notifications */
|
||||
wpsc_settings_page_update_notification();
|
||||
?>
|
||||
<table class='wpsc_options form-table'>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Base Country/Region', 'wpsc' ); ?>: </th>
|
||||
<td>
|
||||
<select name='wpsc_options[base_country]' onchange='submit_change_country();'>
|
||||
|
||||
<?php echo country_list( esc_attr( get_option( 'base_country' ) ) ); ?>
|
||||
|
||||
</select>
|
||||
<span id='options_country'>
|
||||
<?php
|
||||
$region_list = $wpdb->get_results( "SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "`, `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `" . WPSC_TABLE_CURRENCY_LIST . "`.`isocode` IN('" . esc_attr( get_option( 'base_country' ) ) . "') AND `" . WPSC_TABLE_CURRENCY_LIST . "`.`id` = `" . WPSC_TABLE_REGION_TAX . "`.`country_id`", ARRAY_A );
|
||||
if ( !empty( $region_list ) ) { ?>
|
||||
|
||||
<select name='wpsc_options[base_region]'>
|
||||
<?php
|
||||
foreach ( $region_list as $region ) {
|
||||
if ( esc_attr( get_option( 'base_region' ) ) == $region['id'] ) {
|
||||
$selected = "selected='selected'";
|
||||
} else {
|
||||
$selected = "";
|
||||
}
|
||||
?>
|
||||
<option value='<?php echo $region['id']; ?>' <?php echo $selected; ?> ><?php echo esc_attr( $region['name'] ); ?></option> <?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<?php } ?>
|
||||
</span>
|
||||
<br /><?php _e( 'Select your primary business location.', 'wpsc' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
/* START OF TARGET MARKET SELECTION */
|
||||
$countrylist = $wpdb->get_results( "SELECT id,country,visible FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC ", ARRAY_A );
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'Target Markets', 'wpsc' ); ?>:
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
// check for the suhosin module
|
||||
if ( @extension_loaded( 'suhosin' ) && (@ini_get( 'suhosin.post.max_vars' ) > 0) && (@ini_get( 'suhosin.post.max_vars' ) < 500) ) {
|
||||
echo "<em>" . __( "The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature then disable the suhosin extension, if you can not do this, you will need to contact your hosting provider.", 'wpsc' ) . "</em>";
|
||||
} else {
|
||||
?>
|
||||
<span><?php printf(__('Select: <a href="%1$s" class="wpsc_select_all" title="All">All</a> <a href="%1$s" class="wpsc_select_none" title="None">None</a>' , 'wpsc') , add_query_arg( array( 'selected_all' => 'all' ) ), add_query_arg( array( 'selected_all' => 'none' ) ) ); ?></span><br />
|
||||
<div id='resizeable' class='ui-widget-content multiple-select'>
|
||||
<?php
|
||||
foreach ( (array)$countrylist as $country ) {
|
||||
$country['country'] = htmlspecialchars( $country['country'] );
|
||||
if ( $country['visible'] == 1 ) {
|
||||
?>
|
||||
<input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' checked='checked' /> <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo $country['country']; ?></label><br />
|
||||
<?php } else {
|
||||
?>
|
||||
<input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' /> <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_attr_e( $country['country'] ); ?></label><br />
|
||||
<?php }
|
||||
} ?>
|
||||
</div><br />
|
||||
<?php _e( 'Select the markets you are selling products to.' , 'wpsc');
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3 class="form_group"><?php _e( 'Currency Settings', 'wpsc' ); ?>:</h3>
|
||||
<table class='wpsc_options form-table'>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Currency Type', 'wpsc' ); ?>:</th>
|
||||
<td>
|
||||
<select name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
|
||||
<?php
|
||||
$currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
|
||||
foreach ( $currency_data as $currency ) {
|
||||
if ( esc_attr( get_option( 'currency_type' ) ) == $currency['id'] ) {
|
||||
$selected = "selected='selected'";
|
||||
} else {
|
||||
$selected = "";
|
||||
} ?>
|
||||
<option value='<?php echo $currency['id']; ?>' <?php echo $selected; ?> ><?php echo htmlspecialchars( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)</option>
|
||||
<?php
|
||||
}
|
||||
$currency_data = $wpdb->get_row( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . esc_attr( get_option( 'currency_type' ) ) . "' LIMIT 1", ARRAY_A );
|
||||
if ( $currency_data['symbol'] != '' ) {
|
||||
$currency_sign = esc_attr( $currency_data['symbol_html'] );
|
||||
} else {
|
||||
$currency_sign = esc_attr( $currency_data['code'] );
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Currency Sign Location', 'wpsc' ); ?>:</th>
|
||||
<td>
|
||||
<?php
|
||||
$currency_sign_location = esc_attr( get_option( 'currency_sign_location' ) );
|
||||
$csl1 = "";
|
||||
$csl2 = "";
|
||||
$csl3 = "";
|
||||
$csl4 = "";
|
||||
switch ( $currency_sign_location ) {
|
||||
case 1:
|
||||
$csl1 = "checked ='checked'";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$csl2 = "checked ='checked'";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$csl3 = "checked ='checked'";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$csl4 = "checked ='checked'";
|
||||
break;
|
||||
} ?>
|
||||
<input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
|
||||
<label for='csl1'>100<span id='cslchar1'><?php echo $currency_sign; ?></span></label>
|
||||
<input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
|
||||
<label for='csl2'>100 <span id='cslchar2'><?php echo $currency_sign; ?></span></label>
|
||||
<input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
|
||||
<label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span>100</label>
|
||||
<input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
|
||||
<label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> 100</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Thousands and decimal separators', 'wpsc' ); ?>:</th>
|
||||
<td>
|
||||
<?php _e( 'Thousands separator', 'wpsc' ); ?>: <input name="wpsc_options[wpsc_thousands_separator]" type="text" maxlength="1" size="1" value="<?php echo esc_attr( stripslashes( get_option( 'wpsc_thousands_separator' ) ) ); ?>" /> <br />
|
||||
<?php _e( 'Decimal separator', 'wpsc' ); ?>: <input name="wpsc_options[wpsc_decimal_separator]" type="text" maxlength="1" size="1" value="<?php echo esc_attr( stripslashes( get_option( 'wpsc_decimal_separator' ) ) ); ?>" /> <br />
|
||||
<?php _e( 'Preview:', 'wpsc' ); ?> 10<?php echo esc_attr( stripslashes( get_option( 'wpsc_thousands_separator' ) ) ); ?>000<?php echo esc_attr( stripslashes( get_option( 'wpsc_decimal_separator' ) ) ); ?>00
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php do_action('wpsc_general_settings_page'); ?>
|
||||
<div class="submit">
|
||||
<input type='hidden' name='wpsc_admin_action' value='submit_options' />
|
||||
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
||||
<input type="submit" value="<?php _e( 'Update »', 'wpsc' ); ?>" name="updateoption" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@ -1,170 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file handles the standard importing of products through a csv file upload. Access this page via WP-admin Settings>Import
|
||||
* @package WP e-Commerce
|
||||
*/
|
||||
function wpsc_options_import() {
|
||||
global $wpdb;
|
||||
?>
|
||||
<form name='cart_options' enctype='multipart/form-data' id='cart_options' method='post' action='<?php echo 'admin.php?page=wpsc-settings&tab=import'; ?>' class='wpsc_form_track'>
|
||||
<div class="wrap">
|
||||
<?php _e( '<p>You can import your products from a comma delimited text file.</p><p>An example of a csv import file would look like this: </p><p>Description, Additional Description, Product Name, Price, SKU, weight, weight unit, stock quantity, is limited quantity</p>', 'wpsc' ); ?>
|
||||
|
||||
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
||||
<input type='hidden' name='MAX_FILE_SIZE' value='5000000' />
|
||||
<input type='file' name='csv_file' />
|
||||
<input type='submit' value='Import' class='button-primary'>
|
||||
<?php
|
||||
if ( isset( $_FILES['csv_file']['name'] ) && ($_FILES['csv_file']['name'] != '') ) {
|
||||
ini_set( "auto_detect_line_endings", 1 );
|
||||
$file = $_FILES['csv_file'];
|
||||
if ( move_uploaded_file( $file['tmp_name'], WPSC_FILE_DIR . $file['name'] ) ) {
|
||||
$content = file_get_contents( WPSC_FILE_DIR . $file['name'] );
|
||||
$handle = @fopen( WPSC_FILE_DIR . $file['name'], 'r' );
|
||||
while ( ($csv_data = @fgetcsv( $handle, filesize( $handle ), "," )) !== false ) {
|
||||
$fields = count( $csv_data );
|
||||
for ( $i = 0; $i < $fields; $i++ ) {
|
||||
if ( !is_array( $data1[$i] ) ) {
|
||||
$data1[$i] = array( );
|
||||
}
|
||||
array_push( $data1[$i], $csv_data[$i] );
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['cvs_data'] = $data1;
|
||||
$categories = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $category_id );
|
||||
?>
|
||||
|
||||
<p><?php _e( 'For each column, select the field it corresponds to in \'Belongs to\'. You can upload as many products as you like.', 'wpsc' ); ?></p>
|
||||
<div class='metabox-holder' style='width:90%'>
|
||||
<input type='hidden' name='csv_action' value='import'>
|
||||
|
||||
<div style='width:100%;' class='postbox'>
|
||||
<h3 class='hndle'><?php _e('Product Status' , 'wpsc' ); ?></h3>
|
||||
<div class='inside'>
|
||||
<table>
|
||||
<tr><td style='width:80%;'>
|
||||
<?php _e( 'Select if you would like to import your products in as Drafts or Publish them right away.' , 'wpsc' ); ?>
|
||||
<br />
|
||||
</td><td>
|
||||
<select name='post_status'>
|
||||
<option value='publish'><?php _e('Publish', 'wpsc'); ?></option>
|
||||
<option value='draft'><?php _e('Draft', 'wpsc'); ?></option>
|
||||
</select>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
foreach ( (array)$data1 as $key => $datum ) {
|
||||
?>
|
||||
<div style='width:100%;' class='postbox'>
|
||||
<h3 class='hndle'><?php printf(__('Column (%s)', 'wpsc'), ($key + 1)); ?></h3>
|
||||
<div class='inside'>
|
||||
<table>
|
||||
<tr><td style='width:80%;'>
|
||||
<input type='hidden' name='column[]' value='<?php echo $key + 1; ?>'>
|
||||
<?php
|
||||
foreach ( $datum as $column ) {
|
||||
echo $column;
|
||||
break;
|
||||
} ?>
|
||||
<br />
|
||||
</td><td>
|
||||
<select name='value_name[]'>
|
||||
<!-- /* These are the current fields that can be imported with products, to add additional fields add more <option> to this dorpdown list */ -->
|
||||
<option value='name'><?php _e('Product Name', 'wpsc'); ?></option>
|
||||
<option value='description'><?php _e('Description', 'wpsc'); ?></option>
|
||||
<option value='additional_description'><?php _e('Additional Description', 'wpsc'); ?></option>
|
||||
<option value='price'><?php _e('Price', 'wpsc'); ?></option>
|
||||
<option value='sku'><?php _e('SKU', 'wpsc'); ?></option>
|
||||
<option value='weight'><?php _e('Weight', 'wpsc'); ?></option>
|
||||
<option value='weight_unit'><?php _e('Weight Unit', 'wpsc'); ?></option>
|
||||
<option value='quantity'><?php _e('Stock Quantity', 'wpsc'); ?></option>
|
||||
<option value='quantity_limited'><?php _e('Stock Quantity Limit', 'wpsc'); ?></option>
|
||||
</select>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<label for='category'><?php _e('Please select a category you would like to place all products from this CSV into' , 'wpsc' ); ?>:</label>
|
||||
<select id='category' name='category'>
|
||||
<?php
|
||||
foreach ( $categories as $category ) {
|
||||
echo '<option value="' . $category->term_id . '">' . $category->name . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type='submit' value='Import' class='button-primary'>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
echo "<br /><br />" . __('There was an error while uploading your csv file.', 'wpsc');
|
||||
}
|
||||
}
|
||||
if ( isset( $_POST['csv_action'] ) && ('import' == $_POST['csv_action']) ) {
|
||||
global $wpdb;
|
||||
$cvs_data = $_SESSION['cvs_data'];
|
||||
$column_data = $_POST['column'];
|
||||
$value_data = $_POST['value_name'];
|
||||
|
||||
$status = esc_attr($_POST['post_status']);
|
||||
|
||||
$name = array( );
|
||||
foreach ( $value_data as $key => $value ) {
|
||||
|
||||
$cvs_data2[$value] = $cvs_data[$key];
|
||||
}
|
||||
$num = count( $cvs_data2['name'] );
|
||||
|
||||
for ( $i = 0; $i < $num; $i++ ) {
|
||||
$product_columns = array(
|
||||
'post_title' => esc_attr( $cvs_data2['name'][$i] ),
|
||||
'content' => esc_attr( $cvs_data2['description'][$i] ),
|
||||
'additional_description' => esc_attr( $cvs_data2['additional_description'][$i] ),
|
||||
'price' => esc_attr( str_replace( '$', '', $cvs_data2['price'][$i] ) ),
|
||||
'weight' => esc_attr( $cvs_data2['weight'][$i] ),
|
||||
'weight_unit' => esc_attr( $cvs_data2['weight_unit'][$i] ),
|
||||
'pnp' => null,
|
||||
'international_pnp' => null,
|
||||
'file' => null,
|
||||
'image' => '0',
|
||||
'quantity_limited' => esc_attr( $cvs_data2['quantity_limited'][$i] ),
|
||||
'quantity' => esc_attr( $cvs_data2['quantity'][$i] ),
|
||||
'special' => null,
|
||||
'special_price' => null,
|
||||
'display_frontpage' => null,
|
||||
'notax' => null,
|
||||
'active' => null,
|
||||
'donation' => null,
|
||||
'no_shipping' => null,
|
||||
'thumbnail_image' => null,
|
||||
'thumbnail_state' => null,
|
||||
'meta' => array(
|
||||
'_wpsc_price' => esc_attr( str_replace( '$', '', $cvs_data2['price'][$i] ) ),
|
||||
'_wpsc_sku' => esc_attr( $cvs_data2['sku'][$i] ),
|
||||
'_wpsc_stock' => esc_attr( $cvs_data2['quantity'][$i] ),
|
||||
'_wpsc_limited_stock' => esc_attr( $cvs_data2['quantity_limited'][$i] ),
|
||||
'_wpsc_product_metadata' => array(
|
||||
'weight' => esc_attr( $cvs_data2['weight'][$i] ),
|
||||
'weight_unit' => esc_attr( $cvs_data2['weight_unit'][$i] ),
|
||||
)
|
||||
)
|
||||
);
|
||||
$product_columns = wpsc_sanitise_product_forms( $product_columns );
|
||||
// status needs to be set here because wpsc_sanitise_product_forms overwrites it :/
|
||||
$product_columns['post_status'] = $status;
|
||||
$product_id = wpsc_insert_product( $product_columns );
|
||||
wp_set_object_terms( $product_id , array( (int)$_POST['category'] ) , 'wpsc_product_category' );
|
||||
}
|
||||
echo "<br /><br />". sprintf(__("Success, your <a href='%s'>products</a> have been upload.", "wpsc"), admin_url('edit.php?post_type=wpsc-product'));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* options marketing is the main function for displaying the WP-Admin : Settings > Marketing page
|
||||
* @access public
|
||||
*
|
||||
* @since 3.8
|
||||
* @param null
|
||||
* @return null
|
||||
*/
|
||||
function wpsc_options_marketing() {
|
||||
|
||||
/* wpsc_setting_page_update_notification displays the wordpress styled notifications */
|
||||
wpsc_settings_page_update_notification(); ?>
|
||||
|
||||
<div class='metabox-holder'>
|
||||
<?php
|
||||
add_meta_box( 'wpsc_marketing_settings', __( 'Marketing Section', 'wpsc' ), 'wpsc_marketing_meta_box', 'wpsc' );
|
||||
add_meta_box( 'wpsc_rss_address', __( 'RSS Address', 'wpsc' ), 'wpsc_rss_address_meta_box', 'wpsc' );
|
||||
add_meta_box( 'wpsc_google_merch_center', __( 'Google Merchant Centre / Google Product Search', 'wpsc' ), 'wpsc_google_merch_center_meta_box', 'wpsc' );
|
||||
|
||||
do_meta_boxes( 'wpsc', 'advanced', null );
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function wpsc_marketing_meta_box() {
|
||||
|
||||
$wpsc_also_bought = get_option( 'wpsc_also_bought' );
|
||||
$wpsc_also_bought1 = '';
|
||||
|
||||
if ( '1' == $wpsc_also_bought )
|
||||
$wpsc_also_bought1 = "checked ='checked'";
|
||||
|
||||
$wpsc_share_this = get_option( 'wpsc_share_this' );
|
||||
$wpsc_share_this1 = '';
|
||||
|
||||
if ( '1' == $wpsc_share_this )
|
||||
$wpsc_share_this1 = "checked ='checked'";
|
||||
|
||||
$facebook_like = get_option( 'wpsc_facebook_like' );
|
||||
$facebook_like1 = '';
|
||||
if ( 'on' == $facebook_like )
|
||||
$facebook_like1 = "checked ='checked'";
|
||||
|
||||
$display_find_us = get_option( 'display_find_us' );
|
||||
$display_find_us1 = '';
|
||||
|
||||
if ( '1' == $display_find_us )
|
||||
$display_find_us1 = "checked ='checked'"; ?>
|
||||
|
||||
|
||||
<form method='post' action='' id='cart_options' name='cart_options' class='wpsc_form_track'>
|
||||
<input type='hidden' name='change-settings' value='true' />
|
||||
<p>
|
||||
<span class='input_label'><?php _e( 'Display Cross Sales', 'wpsc' ); ?></span>
|
||||
<input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
|
||||
<span class='description'> <?php _e( 'Adds the \'Users who bought this also bought\' item to the single products page.', 'wpsc' ); ?></span>
|
||||
</p><br />
|
||||
<p>
|
||||
<span class='input_label'><?php _e( 'Show Share This (Social Bookmarks)', 'wpsc' ); ?></span>
|
||||
<input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
|
||||
<span class='description'> <?php _e( 'Adds the \'Share this link\' item to the single products page.', 'wpsc' ); ?></span>
|
||||
</p><br />
|
||||
<p>
|
||||
<span class='input_label'> <?php _e( 'Display How Customer Found Us Survey', 'wpsc' ) ?></span>
|
||||
<input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
|
||||
<span class='description'> <?php _e( 'Adds the \'How did you find out about us\' drop-down option at checkout.', 'wpsc' ) ?></span>
|
||||
</p><br />
|
||||
<p>
|
||||
<span class='input_label'> <?php _e( 'Display Facebook Like', 'wpsc' ) ?></span>
|
||||
<input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
|
||||
<input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
|
||||
<span class='description'> <?php _e( 'Adds the Facebook Like button on your single products page.', 'wpsc' ) ?></span>
|
||||
</p><br />
|
||||
<div class="submit">
|
||||
<input type='hidden' name='wpsc_admin_action' value='submit_options' />
|
||||
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
||||
<input type='submit' class='button-primary' value='<?php _e( 'Update »', 'wpsc' ); ?>' name='form_submit' />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
function wpsc_rss_address_meta_box() { ?>
|
||||
|
||||
<p><?php _e( 'People can use this RSS feed to keep up to date with your product list.', 'wpsc' ); ?></p>
|
||||
<p><?php _e( 'RSS Feed Address', 'wpsc' ) ?> : <?php echo get_bloginfo( 'url' ) . "/index.php?rss=true&action=product_list"; ?></p>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
function wpsc_google_merch_center_meta_box() { ?>
|
||||
|
||||
<p><?php _e( 'To import your products into <a href="http://www.google.com/merchants/" target="_blank">Google Merchant Centre</a> so that they appear within Google Product Search results, sign up for a Google Merchant Centre account and add a scheduled data feed with the following URL:', 'wpsc' ); ?></p>
|
||||
|
||||
<?php $google_feed_url = get_bloginfo( 'url' ) . "/index.php?rss=true&action=product_list&xmlformat=google"; ?>
|
||||
|
||||
<a href="<?php esc_attr_e( htmlentities( $google_feed_url, ENT_QUOTES, 'UTF-8' ) ); ?>"><?php esc_attr_e( htmlentities( $google_feed_url, ENT_QUOTES, 'UTF-8' ) ); ?></a>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,274 +0,0 @@
|
||||
<?php
|
||||
|
||||
function wpsc_options_shipping() {
|
||||
global $wpdb, $wpsc_shipping_modules, $external_shipping_modules, $internal_shipping_modules;
|
||||
// sort into external and internal arrays.
|
||||
foreach ( $GLOBALS['wpsc_shipping_modules'] as $key => $module ) {
|
||||
if(empty($module))continue;
|
||||
if ( isset( $module->is_external ) && ($module->is_external == true) ) {
|
||||
$external_shipping_modules[$key] = $module;
|
||||
} else {
|
||||
$internal_shipping_modules[$key] = $module;
|
||||
}
|
||||
}
|
||||
$currency_data = $wpdb->get_row( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . get_option( 'currency_type' ) . "' LIMIT 1", ARRAY_A );
|
||||
if ( $currency_data['symbol'] != '' ) {
|
||||
$currency_sign = $currency_data['symbol_html'];
|
||||
} else {
|
||||
$currency_sign = $currency_data['code'];
|
||||
}
|
||||
//get shipping options that are selected
|
||||
$selected_shippings = get_option( 'custom_shipping_options' );
|
||||
?>
|
||||
<form name='cart_options' id='cart_options' method='post' action='' class='wpsc_form_track'>
|
||||
|
||||
<script type='text/javascript'>
|
||||
function selectgateway() {
|
||||
document.forms.shippingopt.submit();
|
||||
}
|
||||
</script>
|
||||
<div class="wrap">
|
||||
<div class="metabox-holder">
|
||||
<form name='shippingopt' method='post' id='shipping_options' action='' class='wpsc_form_track'>
|
||||
<input type='hidden' name='shipping_submits' value='true' />
|
||||
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
||||
<input type='hidden' name='wpsc_admin_action' value='submit_options' />
|
||||
|
||||
<?php
|
||||
|
||||
if ( !isset( $_SESSION['previous_shipping_name'] ) )
|
||||
$_SESSION['previous_shipping_name'] = "";
|
||||
|
||||
$shipping_data = wpsc_get_shipping_form( $_SESSION['previous_shipping_name'] );
|
||||
|
||||
if ( get_option( 'custom_gateway' ) == 1 ) {
|
||||
$custom_gateway_hide = "style='display:block;'";
|
||||
$custom_gateway1 = 'checked="checked"';
|
||||
} else {
|
||||
$custom_gateway_hide = "style='display:none;'";
|
||||
$custom_gateway2 = 'checked="checked"';
|
||||
}
|
||||
if ( $shipping_data['has_submit_button'] == 0 )
|
||||
$update_button_css = 'style= "display: none;"';
|
||||
else
|
||||
$update_button_css = '';
|
||||
/* wpsc_setting_page_update_notification displays the wordpress styled notifications */
|
||||
wpsc_settings_page_update_notification(); ?>
|
||||
<div class='postbox'>
|
||||
<h3 class='hndle'><?php _e( 'General Settings', 'wpsc' ); ?></h3>
|
||||
<div class='inside'>
|
||||
|
||||
<table class='wpsc_options form-table'>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'Use Shipping', 'wpsc' ); ?>:
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
$do_not_use_shipping = get_option( 'do_not_use_shipping' );
|
||||
$do_not_use_shipping1 = "";
|
||||
$do_not_use_shipping2 = "";
|
||||
if( $do_not_use_shipping )
|
||||
$do_not_use_shipping1 = "checked ='checked'";
|
||||
else
|
||||
$do_not_use_shipping2 = "checked ='checked'";
|
||||
?>
|
||||
<input type='radio' value='0' name='wpsc_options[do_not_use_shipping]' id='do_not_use_shipping2' <?php echo $do_not_use_shipping2; ?> /> <label for='do_not_use_shipping2'><?php _e( 'Yes', 'wpsc' ); ?></label>
|
||||
<input type='radio' value='1' name='wpsc_options[do_not_use_shipping]' id='do_not_use_shipping1' <?php echo $do_not_use_shipping1; ?> /> <label for='do_not_use_shipping1'><?php _e( 'No', 'wpsc' ); ?></label><br />
|
||||
<?php _e( 'If you are only selling digital downloads, you should select no to disable the shipping on your site.', 'wpsc' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php _e( 'Base City:', 'wpsc' ); ?></th>
|
||||
<td>
|
||||
<input type='text' name='wpsc_options[base_city]' value='<?php esc_attr_e( get_option( 'base_city' ) ); ?>' />
|
||||
<br /><?php _e( 'Please provide for more accurate rates', 'wpsc' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php _e( 'Base Zipcode/Postcode:', 'wpsc' ); ?></th>
|
||||
<td>
|
||||
<input type='text' name='wpsc_options[base_zipcode]' value='<?php esc_attr_e( get_option( 'base_zipcode' ) ); ?>' />
|
||||
<br /><?php _e( 'If you are based in America then you need to set your own Zipcode for UPS and USPS to work. This should be the Zipcode for your Base of Operations.', 'wpsc' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$shipwire1 = "";
|
||||
$shipwire2 = "";
|
||||
switch ( get_option( 'shipwire' ) ) {
|
||||
case 1:
|
||||
$shipwire1 = "checked ='checked'";
|
||||
$shipwire_settings = 'style=\'display: block;\'';
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
$shipwire2 = "checked ='checked'";
|
||||
$shipwire_settings = '';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'ShipWire Settings', 'wpsc' ); ?><span style='color: red;'></span> :
|
||||
</th>
|
||||
<td>
|
||||
<input type='radio' onclick='jQuery("#wpsc_shipwire_setting").show()' value='1' name='wpsc_options[shipwire]' id='shipwire1' <?php echo $shipwire1; ?> /> <label for='shipwire1'><?php _e( 'Yes', 'wpsc' ); ?></label>
|
||||
<input type='radio' onclick='jQuery("#wpsc_shipwire_setting").hide()' value='0' name='wpsc_options[shipwire]' id='shipwire2' <?php echo $shipwire2; ?> /> <label for='shipwire2'><?php _e( 'No', 'wpsc' ); ?></label>
|
||||
<?php
|
||||
$shipwireemail = esc_attr_e( get_option( "shipwireemail" ) );
|
||||
$shipwirepassword = esc_attr_e( get_option( "shipwirepassword" ) );
|
||||
?>
|
||||
<div id='wpsc_shipwire_setting' <?php echo $shipwire_settings; ?>>
|
||||
<table>
|
||||
<tr><td><?php _e( 'ShipWire Email', 'wpsc' ); ?> :</td><td> <input type="text" name='wpsc_options[shipwireemail]' value="<?php echo $shipwireemail; ?>" /></td></tr>
|
||||
<tr><td><?php _e( 'ShipWire Password', 'wpsc' ); ?> :</td><td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php echo $shipwirepassword; ?>" /></td></tr>
|
||||
<tr><td><a onclick='shipwire_sync()' style="cursor:pointer;">Sync product</a></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'Enable Free Shipping Discount', 'wpsc' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
if ( get_option( 'shipping_discount' ) == 1 ) {
|
||||
$selected2 = '';
|
||||
$selected1 = 'checked="checked"';
|
||||
$shipping_discount_settings = 'style=\'display: block;\'';
|
||||
} else {
|
||||
$selected2 = 'checked="checked"';
|
||||
$selected1 = '';
|
||||
$shipping_discount_settings = '';
|
||||
}
|
||||
?>
|
||||
<input type='radio' onclick='jQuery("#shipping_discount_value").show()' value='1' name='wpsc_options[shipping_discount]' id='shipping_discount1' <?php echo $selected1; ?> /> <label for='shipping_discount1'><?php _e( 'Yes', 'wpsc' ); ?></label>
|
||||
<input type='radio' onclick='jQuery("#shipping_discount_value").hide()' value='0' name='wpsc_options[shipping_discount]' id='shipping_discount2' <?php echo $selected2; ?> /> <label for='shipping_discount2'><?php _e( 'No', 'wpsc' ); ?></label>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td colspan="2">
|
||||
<?php
|
||||
$value = esc_attr ( get_option( 'shipping_discount_value' ) );
|
||||
?>
|
||||
<div <?php echo $shipping_discount_settings; ?> id='shipping_discount_value'>
|
||||
|
||||
<?php printf(__('Sales over or equal to: %1$s<input type="text" size="6" name="wpsc_options[shipping_discount_value]" value="%2$s" id="shipping_discount_value" /> will receive free shipping.', 'wpsc'), $currency_sign, $value ); ?>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class='submit' <?php echo $update_button_css; ?>>
|
||||
<input type='submit' value='<?php _e( 'Update »', 'wpsc' ); ?>' name='updateoption' />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php do_action('wpsc_shipping_settings_page'); ?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<table id='gateway_options' >
|
||||
<tr>
|
||||
<td class='select_gateway'>
|
||||
<a name="gateway_options"></a>
|
||||
<div class='postbox'>
|
||||
<h3 class='hndle'><?php _e( 'Shipping Modules', 'wpsc' ) ?></h3>
|
||||
<div class='inside'>
|
||||
|
||||
<p>
|
||||
<?php _e( 'To enable shipping in WP e-Commerce you must select which shipping methods you want to enable on your site.<br /> If you want to use fixed-price shipping options like "Pickup - $0, Overnight - $10, Same day - $20, etc." you can download a WordPress plugin from plugins directory for <a href="http://wordpress.org/extend/plugins/wp-e-commerce-fixed-rate-shipping/">Simple shipping</a>. It will appear in the list as "Fixed rate".', 'wpsc' ); ?>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<strong><?php _e( 'Internal Shipping Calculators', 'wpsc' ); ?></strong>
|
||||
</p>
|
||||
<?php
|
||||
foreach ( $internal_shipping_modules as $shipping ) {
|
||||
|
||||
$shipping->checked = '';
|
||||
if ( is_object( $shipping ) && in_array( $shipping->getInternalName(), (array)$selected_shippings ) )
|
||||
$shipping->checked = ' checked = "checked" ';
|
||||
?>
|
||||
|
||||
<div class='wpsc_shipping_options'>
|
||||
<div class='wpsc-shipping-actions'>
|
||||
| <span class="edit">
|
||||
<a class='edit-shipping-module' rel="<?php echo $shipping->internal_name; ?>" title="Edit this Shipping Module" href='<?php echo htmlspecialchars( add_query_arg('tab', 'shipping' , add_query_arg('page', 'wpsc-settings' , add_query_arg( 'shipping_module', $shipping->internal_name ) ) ) ); ?>#gateway_options' style="cursor:pointer;">Edit</a>
|
||||
</span> |
|
||||
</div>
|
||||
|
||||
<p><input name='custom_shipping_options[]' <?php echo $shipping->checked; ?> type='checkbox' value='<?php echo $shipping->internal_name; ?>' id='<?php echo $shipping->internal_name; ?>_id' /><label for='<?php echo $shipping->internal_name; ?>_id'><?php echo $shipping->name; ?></label></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<br />
|
||||
<p>
|
||||
<strong><?php _e( 'External Shipping Calculators', 'wpsc' ); ?></strong>
|
||||
<?php if ( !function_exists( 'curl_init' ) ) {
|
||||
?>
|
||||
<br /><span style='color: red; font-size:8pt; line-height:10pt;'><?php _e( 'The following shipping modules all need cURL which is not installed on this server, you may need to contact your web hosting provider to get it set up. ', 'wpsc' ); ?></span>
|
||||
<?php } ?>
|
||||
</p>
|
||||
<?php
|
||||
// print the internal shipping methods
|
||||
foreach ( $external_shipping_modules as $shipping ) {
|
||||
$disabled = '';
|
||||
if ( isset($shipping->requires_curl) && ($shipping->requires_curl == true) && !function_exists( 'curl_init' ) ) {
|
||||
$disabled = "disabled='disabled'";
|
||||
}
|
||||
$shipping->checked = '';
|
||||
if ( in_array( $shipping->getInternalName(), (array)$selected_shippings ) )
|
||||
$shipping->checked = " checked='checked' ";
|
||||
?>
|
||||
<div class='wpsc_shipping_options'>
|
||||
<div class="wpsc-shipping-actions">
|
||||
| <span class="edit">
|
||||
<a class='edit-shippping-module' rel="<?php echo $shipping->internal_name; ?>" title="Edit this Shipping Module" href='<?php echo htmlspecialchars( add_query_arg('tab', 'shipping' , add_query_arg('page', 'wpsc-settings' , add_query_arg( 'shipping_module', $shipping->internal_name ) ) ) ); ?>#gateway_options' style="cursor:pointer;"><?php _e( 'Edit' , 'wpsc' ); ?></a>
|
||||
</span> |
|
||||
</div>
|
||||
<p><input <?php echo $disabled; ?> name='custom_shipping_options[]' <?php echo $shipping->checked; ?> type='checkbox' value='<?php echo $shipping->internal_name; ?>' id='<?php echo $shipping->internal_name; ?>_id' /><label for='<?php echo $shipping->internal_name; ?>_id'><?php esc_attr_e( $shipping->name ); ?></label></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class='submit gateway_settings'>
|
||||
<input type='hidden' value='true' name='update_gateways'/>
|
||||
<input type='submit' value='<?php _e( 'Update »', 'wpsc' ); ?>' name='updateoption'/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class='gateway_settings' rowspan='2'>
|
||||
<div class='postbox'>
|
||||
<h3 class='hndle'><?php esc_html( $shipping_data['name'] ); ?></h3>
|
||||
<div class='inside'>
|
||||
<table class='form-table'>
|
||||
<?php echo $shipping_data['form_fields']; ?>
|
||||
</table>
|
||||
|
||||
<div class='submit' <?php echo $update_button_css; ?>>
|
||||
<input type='submit' value='<?php _e( 'Update »', 'wpsc' ); ?>' name='updateoption' />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@ -1,188 +0,0 @@
|
||||
<?php
|
||||
|
||||
function wpec_options_taxes() {
|
||||
$wpec_taxes_controller = new wpec_taxes_controller;
|
||||
$wpec_taxes_options = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_options();
|
||||
|
||||
//include standard shopping cart notifications
|
||||
wpsc_settings_page_update_notification();
|
||||
?>
|
||||
<form name='wpec_taxes_options' id='wpec_taxes_options' method='post' action='' class='wpsc_form_track'>
|
||||
<div class="wrap">
|
||||
<h3><?php _e( 'Tax Settings', 'wpsc' ); ?></h3>
|
||||
<p>
|
||||
<label for='wpec_taxes_enabled'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_enabled'] ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="checkbox" id='wpec_taxes_enabled' name='wpsc_options[wpec_taxes_enabled]' />
|
||||
<?php _e( 'Turn tax on', 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for='wpec_taxes_inprice1'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'exclusive' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='exclusive' id='wpec_taxes_inprice1' name='wpsc_options[wpec_taxes_inprice]' />
|
||||
<?php _e( 'Product prices are tax exclusive - add tax to the price during checkout', 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for='wpec_taxes_inprice2'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'inclusive' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='inclusive' id='wpec_taxes_inprice2' name='wpsc_options[wpec_taxes_inprice]' />
|
||||
<?php _e( "Product prices are tax inclusive - during checkout the total price doesn't increase but tax is shown as a line item", 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<h4><?php _e( 'Product Specific Tax', 'wpsc' ); ?></h4>
|
||||
<p>
|
||||
<label for='wpec_taxes_product_1'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'add' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='add' id='wpec_taxes_product_1' name='wpsc_options[wpec_taxes_product]' />
|
||||
<?php _e( 'Add per product tax to tax percentage if product has a specific tax rate', 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for='wpec_taxes_product_2'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'replace' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='replace' id='wpec_taxes_product_2' name='wpsc_options[wpec_taxes_product]' />
|
||||
<?php _e( 'Replace tax percentage with product specific tax rate', 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<h4><?php _e( 'Tax Logic', 'wpsc' ); ?></h4>
|
||||
<p>
|
||||
<label for='wpec_taxes_logic_1'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='billing_shipping' id='wpec_taxes_logic_1' name='wpsc_options[wpec_taxes_logic]' />
|
||||
<?php _e( 'Apply tax when Billing and Shipping Country is the same as Tax Rate', 'wpsc' ); ?>
|
||||
</label>
|
||||
<div id='billing_shipping_preference_container' style='margin-left: 20px;'>
|
||||
<p>
|
||||
<label for='wpec_billing_preference'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'billing_address' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='billing_address' id='wpec_billing_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
|
||||
<?php _e( 'Apply tax to Billing Address', 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for='wpec_shipping_preference'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'shipping_address' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='shipping_address' id='wpec_shipping_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
|
||||
<?php _e( 'Apply tax to Shipping Address', 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
</p>
|
||||
<p>
|
||||
<label for='wpec_taxes_logic_2'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='billing' id='wpec_taxes_logic_2' name='wpsc_options[wpec_taxes_logic]' />
|
||||
<?php _e( 'Apply tax when Billing Country is the same as Tax Rate', 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for='wpec_taxes_logic_3'>
|
||||
<input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'shipping' ) {
|
||||
echo 'checked="checked"';
|
||||
} ?> type="radio" value='shipping' id='wpec_taxes_logic_3' name='wpsc_options[wpec_taxes_logic]' />
|
||||
<?php _e( 'Apply tax when Shipping Country is the same as Tax Rate', 'wpsc' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<div id='metabox-holder' class="metabox-holder">
|
||||
<div id='wpec-taxes-rates-container' class='postbox'>
|
||||
<h3 class='hndle' style='cursor: default'><?php _e( 'Tax Rates', 'wpsc' ); ?></h3>
|
||||
<div id='wpec-taxes-rates' class='inside'>
|
||||
<!--Start Taxes Output-->
|
||||
<?php
|
||||
/**
|
||||
* Add New Tax Rate - should add another paragraph with the
|
||||
another key specified for the input array
|
||||
* Delete - Should remove the given paragraph from the page
|
||||
and either ajax delete it from the DB or mark it for
|
||||
deletion and process it after the changes are made.
|
||||
* Selecting a Country - should automatically populate the
|
||||
regions select box. Selecting a different country should
|
||||
remove the region select box. If the user selects a
|
||||
different country with regions it shouldn't matter because
|
||||
the code should automatically add the region select in.
|
||||
* - Allow users to define tax for entire country even if regions exist.
|
||||
* Shipping Tax - needs to be per region or per tax rate.
|
||||
Remove the setting from the main Tax Settings area.
|
||||
* Constraints -
|
||||
1. Should not allow a user to add more than one
|
||||
tax rate for the same area.
|
||||
2. If a country tax rate is specified and then a region tax
|
||||
rate, the region tax rate takes precedence.
|
||||
* */
|
||||
|
||||
/**
|
||||
* Removed Shipping Restriction on Included tax - 01-20-2011
|
||||
//if tax is included warn about shipping
|
||||
if ( $wpec_taxes_controller->wpec_taxes_isincluded() ) {
|
||||
echo '<p>' . __( 'Note: Tax is not applied to shipping when product prices are tax inclusive.' ) . '</p>';
|
||||
}// if
|
||||
**/
|
||||
|
||||
//get current tax rates
|
||||
$tax_rates = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_rates();
|
||||
$tax_rate_count = 0;
|
||||
if ( !empty( $tax_rates ) ) {
|
||||
foreach ( $tax_rates as $tax_rate ) {
|
||||
echo $wpec_taxes_controller->wpec_taxes_build_form( $tax_rate_count, $tax_rate );
|
||||
$tax_rate_count++;
|
||||
}// foreach
|
||||
}// if
|
||||
?>
|
||||
<!--End Taxes Output-->
|
||||
<p>
|
||||
<a id="add_taxes_rate" href="#"><?php _e( 'Add New Tax Rate', 'wpsc' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='wpec-taxes-bands-container' class='postbox'>
|
||||
<h3 class='hndle' style='cursor: default'><?php _e( 'Tax Bands', 'wpsc' ); ?></h3>
|
||||
<div id='wpec-taxes-bands' class='inside'>
|
||||
|
||||
<?php
|
||||
echo '<p>' . __( 'Note: Tax Bands are special tax rules you can create and apply on a per-product basis. <br /> Please visit the product page to apply your Tax Band.', 'wpsc' ) . '</p>';
|
||||
|
||||
//echo message regarding inclusive tax
|
||||
if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) {
|
||||
echo '<p>' . __( 'Note: Tax Bands do not take affect when product prices are tax exclusive.', 'wpsc' ) . '</p>';
|
||||
}// if
|
||||
|
||||
$tax_bands = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_bands();
|
||||
$tax_band_count = 0;
|
||||
if ( !empty( $tax_bands ) ) {
|
||||
foreach ( $tax_bands as $tax_band ) {
|
||||
echo $wpec_taxes_controller->wpec_taxes_build_form( $tax_band_count, $tax_band, 'bands' );
|
||||
$tax_band_count++;
|
||||
}// foreach
|
||||
}// if
|
||||
?>
|
||||
<p>
|
||||
<a id="add_taxes_band" href="#"><?php _e( 'Add New Tax Band', 'wpsc' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div><!--wpec-taxes-bands-container-->
|
||||
</div><!--metabox-holder-->
|
||||
<?php do_action('wpsc_taxes_settings_page'); ?>
|
||||
<div class="submit">
|
||||
<input type='hidden' name='wpec_admin_action' value='submit_taxes_options' />
|
||||
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
||||
<input type="submit" class='button-primary' value="Save Changes" name="submit_taxes" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
// wpec_options_taxes
|
||||
?>
|
||||
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
global $wpdb;
|
||||
$changes_made = false;
|
||||
|
||||
if(preg_match("/[a-zA-Z]{2,4}/",$_GET['isocode']))
|
||||
{
|
||||
$country_isocode = $_GET['isocode'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$country_isocode = get_option('base_country');
|
||||
}
|
||||
$base_region = get_option('base_region');
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php _e('GST/Tax Rate', 'wpsc');?></h2>
|
||||
<?php
|
||||
if($changes_made === true)
|
||||
{
|
||||
echo "Thanks, your changes have been made<br />";
|
||||
}
|
||||
?>
|
||||
<form action='' method='post' name='regional_tax' class='wpsc_form_track'>
|
||||
<?php
|
||||
$country_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode` IN('".$country_isocode."') LIMIT 1",ARRAY_A);
|
||||
if(($country_data['has_regions'] == 1))
|
||||
{
|
||||
$region_data = $wpdb->get_results("SELECT `".WPSC_TABLE_REGION_TAX."`.* FROM `".WPSC_TABLE_REGION_TAX."` WHERE `".WPSC_TABLE_REGION_TAX."`.`country_id` IN('".$country_data['id']."') ",ARRAY_A) ;
|
||||
$region_data = array_chunk($region_data, 14);
|
||||
|
||||
echo "<table>\n\r";
|
||||
echo " <tr>\n\r";
|
||||
foreach($region_data as $region_col)
|
||||
{
|
||||
echo " <td style='vertical-align: top; padding-right: 3em;'>\n\r";
|
||||
echo "<table>\n\r";
|
||||
foreach($region_col as $region)
|
||||
{
|
||||
$tax_percentage = $region['tax'];
|
||||
echo " <tr>\n\r";
|
||||
if($region['id'] == $base_region)
|
||||
{
|
||||
echo " <td><label for='region_tax_".$region['id']."' style='text-decoration: underline;'>".$region['name'].":</label></td>\n\r";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo " <td><label for='region_tax_".$region['id']."'>".$region['name'].":</label></td>\n\r";
|
||||
}
|
||||
echo " <td><input type='text' id='region_tax_".$region['id']."' name='region_tax[".$region['id']."]' value='".$tax_percentage."' class='tax_forms' size='2'/>%</td>\n\r";
|
||||
echo " </tr>\n\r";
|
||||
}
|
||||
echo "</table>\n\r";
|
||||
echo " </td>\n\r";
|
||||
}
|
||||
echo " </tr>\n\r";
|
||||
echo "</table>\n\r";
|
||||
}
|
||||
else
|
||||
{
|
||||
$tax_percentage = $country_data['tax'];
|
||||
echo "<label for='country_tax'>Tax Rate:</label> ";
|
||||
echo "<input type='text' id='country_tax' name='country_tax' value='".$tax_percentage."' class='tax_forms' maxlength='3' size='3'/>%";
|
||||
}
|
||||
?>
|
||||
<input type='hidden' name='wpsc_admin_action' value='change_region_tax' />
|
||||
<input class='button-secondary' type='submit' name='submit' value='<?php _e('Save Changes', 'wpsc');?>' />
|
||||
</form>
|
||||
</div>
|
||||
@ -1,882 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WP eCommerce database updating functions
|
||||
*
|
||||
* @package wp-e-commerce
|
||||
* @since 3.8
|
||||
*/
|
||||
|
||||
class WPSC_Update
|
||||
{
|
||||
private static $instance;
|
||||
private $timeout;
|
||||
private $script_start;
|
||||
private $stages;
|
||||
|
||||
public static function get_instance() {
|
||||
if ( empty( self::$instance ) )
|
||||
self::$instance = new WPSC_Update();
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
private function __construct() {
|
||||
$this->timeout = ini_get( 'max_execution_time' );
|
||||
$this->script_start = time();
|
||||
|
||||
if ( ! $this->stages = get_transient( 'wpsc_update_progress' ) ) {
|
||||
$this->stages = array();
|
||||
}
|
||||
}
|
||||
|
||||
public function clean_up() {
|
||||
delete_transient( 'wpsc_update_progress' );
|
||||
delete_transient( 'wpsc_update_product_offset' );
|
||||
delete_transient( 'wpsc_update_variation_comb_offset' );
|
||||
delete_transient( 'wpsc_update_current_product' );
|
||||
delete_transient( 'wpsc_update_current_child_products' );
|
||||
}
|
||||
|
||||
public function check_timeout() {
|
||||
$safety = 2; // refresh page within 2 seconds of PHP max execution time limit
|
||||
$wiggle_room = $this->timeout - $safety;
|
||||
|
||||
$terminate = time() - $this->script_start >= $wiggle_room;
|
||||
|
||||
if ( $terminate ) {
|
||||
do_action( 'wpsc_update_timeout_terminate' );
|
||||
$location = remove_query_arg( array( 'start_over', 'eta', 'current_percent' ) );
|
||||
$location = add_query_arg( 'run_updates', 1, $location );
|
||||
$location = apply_filters( 'wpsc_update_terminate_location', $location );
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
location.href = "<?php echo $location; ?>"
|
||||
</script>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public function run( $function, $message = '' ) {
|
||||
if ( $message )
|
||||
echo "<p>{$message}</p>";
|
||||
|
||||
if ( empty( $this->stages[$function] ) ) {
|
||||
call_user_func( 'wpsc_' . $function );
|
||||
$this->stages[$function] = true;
|
||||
set_transient( 'wpsc_update_progress', $this->stages, 604800 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WPSC_Update_Progress
|
||||
{
|
||||
private $milestone;
|
||||
private $start;
|
||||
private $count;
|
||||
private $current_percent = 0;
|
||||
private $total;
|
||||
private $eta;
|
||||
private $i;
|
||||
|
||||
public function __construct( $total ) {
|
||||
$this->total = $total;
|
||||
$this->milestone = $this->start = time();
|
||||
if ( ! empty( $_REQUEST['current_percent'] ) )
|
||||
$this->current_percent = (int) $_REQUEST['current_percent'];
|
||||
|
||||
add_filter( 'wpsc_update_terminate_location', array( $this, 'filter_terminate_location' ) );
|
||||
|
||||
echo '<div class="wpsc-progress-bar">';
|
||||
if ( ! empty( $_REQUEST['start_over'] ) )
|
||||
return;
|
||||
|
||||
if ( isset( $_REQUEST['current_percent'] ) ) {
|
||||
echo "<div class='block' style='width:{$_REQUEST['current_percent']}%;'> </div>";
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['eta'] ) ) {
|
||||
$this->eta = (int) $_REQUEST['eta'];
|
||||
$this->print_eta();
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['i'] ) )
|
||||
echo "<span>{$_REQUEST['i']}/{$this->total}</span>";
|
||||
}
|
||||
|
||||
public function filter_terminate_location( $location ) {
|
||||
$location = add_query_arg( array(
|
||||
'current_percent' => $this->current_percent,
|
||||
'i' => $this->i,
|
||||
), $location );
|
||||
if ( $this->eta !== null )
|
||||
$location = add_query_arg( 'eta', $this->eta, $location );
|
||||
else
|
||||
$location = remove_query_arg( 'eta', $location );
|
||||
return $location;
|
||||
}
|
||||
|
||||
private function print_eta() {
|
||||
echo '<div class="eta">';
|
||||
echo __( 'Estimated time left:', 'wpsc' ) . ' ';
|
||||
if ( $this->eta == 0 )
|
||||
echo __( 'Under a minute', 'wpsc' );
|
||||
else
|
||||
printf( _n( '%d minute', '%d minutes', $this->eta ), $this->eta );
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
public function update( $i ) {
|
||||
if ( empty( $this->count ) )
|
||||
$this->count = $i;
|
||||
|
||||
$this->i = $i;
|
||||
$now = time();
|
||||
$percent = min( floor( $i * 100 / $this->total ), 100 );
|
||||
|
||||
if ( $percent != $this->current_percent ) {
|
||||
echo "<div class='block' style='width:{$percent}%;'> </div>";
|
||||
$this->current_percent = $percent;
|
||||
}
|
||||
|
||||
echo "<span>{$i}/{$this->total}</span>";
|
||||
|
||||
if ( $now - $this->milestone >= 5 ) {
|
||||
$processed = $i - $this->count + 1;
|
||||
$this->eta = floor( ( $this->total - $i ) * ( $now - $this->start ) / ( $processed * 60 ) );
|
||||
$this->print_eta();
|
||||
$this->milestone = $now;
|
||||
}
|
||||
|
||||
if ( $percent == 100 ) {
|
||||
remove_filter( 'wpsc_update_terminate_location', array( $this, 'filter_terminate_location' ) );
|
||||
echo '<div class="eta">Done!</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_update_step( $i, $total ) {
|
||||
static $current;
|
||||
static $milestone;
|
||||
static $start;
|
||||
static $count;
|
||||
static $current_percent;
|
||||
|
||||
$now = time();
|
||||
|
||||
if ( $current != $total ) {
|
||||
$current = $total;
|
||||
$milestone = $start = $now;
|
||||
$count = $i;
|
||||
}
|
||||
|
||||
$percent = min( round( $i * 100 / $total, 2 ), 100 );
|
||||
|
||||
if ( floor( $percent ) != $current_percent ) {
|
||||
echo "<div class='block' style='width:{$percent}%;'> </div>";
|
||||
$current_percent = floor( $percent );
|
||||
}
|
||||
|
||||
if ( $now - $milestone == 5 ) {
|
||||
$processed = $i - $count + 1;
|
||||
$eta = floor( ( $total - $i ) * ( $now - $start ) / ( $processed * 60 ) );
|
||||
echo '<div class="eta">';
|
||||
echo __( 'Estimated time left:', 'wpsc' ) . ' ';
|
||||
if ( $eta == 0 )
|
||||
echo __( 'Under a minute', 'wpsc' );
|
||||
else
|
||||
printf( _n( '%d minute', '%d minutes', $eta ), $eta );
|
||||
echo '</div>';
|
||||
$milestone = $now;
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_update_purchase_logs() {
|
||||
global $wpdb;
|
||||
|
||||
// bump all purchase log status
|
||||
$wpdb->query( "UPDATE " . WPSC_TABLE_PURCHASE_LOGS . " SET processed = processed + 1, plugin_version = '" . WPSC_VERSION . "' WHERE plugin_version IN ('3.6', '3.7') " );
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_convert_category_groups function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function wpsc_convert_category_groups() {
|
||||
global $wpdb, $user_ID;
|
||||
$wpsc_update = WPSC_Update::get_instance();
|
||||
|
||||
//if they're updating from 3.6, and they've got categories with no group, let's fix that problem, eh?
|
||||
$categorisation_groups = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CATEGORISATION_GROUPS."` WHERE `active` IN ('1')");
|
||||
if(count($categorisation_groups) == 0) {
|
||||
$sql = "insert into `".WPSC_TABLE_CATEGORISATION_GROUPS."` set `id` = 1000, `name` = 'Default Group', `description` = 'This is your default category group', `active` = 1, `default` = 1;";
|
||||
$wpdb->query($sql);
|
||||
$sql = "update `".WPSC_TABLE_PRODUCT_CATEGORIES."` set group_id = 1000";
|
||||
$wpdb->query($sql);
|
||||
$categorisation_groups = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CATEGORISATION_GROUPS."` WHERE `active` IN ('1')");
|
||||
}
|
||||
|
||||
foreach((array)$categorisation_groups as $cat_group) {
|
||||
$wpsc_update->check_timeout();
|
||||
|
||||
$category_id = wpsc_get_meta($cat_group->id, 'category_group_id', 'wpsc_category_group');
|
||||
|
||||
if(!is_numeric($category_id) || ( $category_id < 1)) {
|
||||
$new_category = wp_insert_term( $cat_group->name, 'wpsc_product_category', array('description' => $cat_group->description));
|
||||
if(!is_wp_error($new_category))
|
||||
$category_id = $new_category['term_id'];
|
||||
|
||||
}
|
||||
if(is_numeric($category_id)) {
|
||||
|
||||
wpsc_update_meta($cat_group->id, 'category_group_id', $category_id, 'wpsc_category_group');
|
||||
wpsc_update_categorymeta($category_id, 'category_group_id', $cat_group->id);
|
||||
|
||||
wpsc_update_categorymeta($category_id, 'image', '');
|
||||
wpsc_update_categorymeta($category_id, 'uses_billing_address', 0);
|
||||
}
|
||||
|
||||
if(! isset( $new_category ) || !is_wp_error($new_category))
|
||||
wpsc_convert_categories($category_id, $cat_group->id);
|
||||
}
|
||||
delete_option("wpsc_product_category_children");
|
||||
_get_term_hierarchy('wpsc_product_category');
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_convert_categories function.
|
||||
*
|
||||
* @access public
|
||||
* @param int $parent_category. (default: 0)
|
||||
* @return void
|
||||
*/
|
||||
function wpsc_convert_categories($new_parent_category, $group_id, $old_parent_category = 0) {
|
||||
global $wpdb, $user_ID;
|
||||
|
||||
if($old_parent_category > 0) {
|
||||
$categorisation = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active` IN ('1') AND `group_id` IN ('{$group_id}') AND `category_parent` IN ('{$old_parent_category}')");
|
||||
} else {
|
||||
$categorisation = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active` IN ('1') AND `group_id` IN ('{$group_id}') AND `category_parent` IN (0)");
|
||||
}
|
||||
$wpsc_update = WPSC_Update::get_instance();
|
||||
|
||||
if($categorisation > 0) {
|
||||
|
||||
foreach((array)$categorisation as $category) {
|
||||
$wpsc_update->check_timeout();
|
||||
$category_id = wpsc_get_meta($category->id, 'category_id', 'wpsc_old_category');
|
||||
|
||||
if(!is_numeric($category_id) || ( $category_id < 1)) {
|
||||
$new_category = wp_insert_term( $category->name, 'wpsc_product_category', array('description' => $category->description, 'parent' => $new_parent_category));
|
||||
if(!is_wp_error($new_category))
|
||||
$category_id = $new_category['term_id'];
|
||||
}
|
||||
|
||||
if(is_numeric($category_id)) {
|
||||
|
||||
wpsc_update_meta($category->id, 'category_id', $category_id, 'wpsc_old_category');
|
||||
wpsc_update_categorymeta($category_id, 'category_id', $category->id);
|
||||
|
||||
wpsc_update_categorymeta($category_id, 'image', $category->image);
|
||||
wpsc_update_categorymeta($category_id, 'display_type', $category->display_type);
|
||||
|
||||
wpsc_update_categorymeta($category_id, 'image_height', $category->image_height);
|
||||
wpsc_update_categorymeta($category_id, 'image_width', $category->image_width);
|
||||
|
||||
$use_additonal_form_set = wpsc_get_categorymeta($category->id, 'use_additonal_form_set');
|
||||
if($use_additonal_form_set != '') {
|
||||
wpsc_update_categorymeta($category_id, 'use_additonal_form_set', $use_additonal_form_set);
|
||||
} else {
|
||||
wpsc_delete_categorymeta($category_id, 'use_additonal_form_set');
|
||||
}
|
||||
|
||||
|
||||
wpsc_update_categorymeta($category_id, 'uses_billing_address', (bool)(int)wpsc_get_categorymeta($category->id, 'uses_billing_address'));
|
||||
|
||||
|
||||
}
|
||||
if($category_id > 0) {
|
||||
wpsc_convert_categories($category_id, $group_id, $category->id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_convert_variation_sets() {
|
||||
global $wpdb, $user_ID;
|
||||
$variation_sets = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_VARIATIONS."`");
|
||||
$wpsc_update = WPSC_Update::get_instance();
|
||||
|
||||
foreach((array)$variation_sets as $variation_set) {
|
||||
$wpsc_update->check_timeout();
|
||||
$variation_set_id = wpsc_get_meta($variation_set->id, 'variation_set_id', 'wpsc_variation_set');
|
||||
|
||||
if(!is_numeric($variation_set_id) || ( $variation_set_id < 1)) {
|
||||
$new_variation_set = wp_insert_term( $variation_set->name, 'wpsc-variation',array('parent' => 0));
|
||||
if(!is_wp_error($new_variation_set))
|
||||
$variation_set_id = $new_variation_set['term_id'];
|
||||
}
|
||||
|
||||
if(is_numeric($variation_set_id)) {
|
||||
wpsc_update_meta($variation_set->id, 'variation_set_id', $variation_set_id, 'wpsc_variation_set');
|
||||
|
||||
|
||||
$variations = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_VARIATION_VALUES."` WHERE `variation_id` IN ({$variation_set->id})");
|
||||
foreach((array)$variations as $variation) {
|
||||
$variation_id = wpsc_get_meta($variation->id, 'variation_id', 'wpsc_variation');
|
||||
|
||||
if(!is_numeric($variation_id) || ( $variation_id < 1)) {
|
||||
$new_variation = wp_insert_term( $variation->name, 'wpsc-variation',array('parent' => $variation_set_id));
|
||||
|
||||
if(!is_wp_error($new_variation))
|
||||
$variation_id = $new_variation['term_id'];
|
||||
}
|
||||
if(is_numeric($variation_id)) {
|
||||
wpsc_update_meta($variation->id, 'variation_id', $variation_id, 'wpsc_variation');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wpsc_convert_products_to_posts function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function wpsc_convert_products_to_posts() {
|
||||
global $wpdb, $user_ID;
|
||||
// Select all products
|
||||
$wpsc_update = WPSC_Update::get_instance();
|
||||
if ( ! empty($wpdb->charset) )
|
||||
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
||||
if ( ! empty($wpdb->collate) )
|
||||
$charset_collate .= " COLLATE $wpdb->collate";
|
||||
|
||||
if ( ! $offset = get_transient( 'wpsc_update_product_offset' ) )
|
||||
$offset = 0;
|
||||
$limit = 90;
|
||||
$sql = "
|
||||
SELECT * FROM " . WPSC_TABLE_PRODUCT_LIST . "
|
||||
WHERE active = '1'
|
||||
LIMIT %d, %d
|
||||
";
|
||||
$post_created = get_transient( 'wpsc_update_current_product' );
|
||||
$total = $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PRODUCT_LIST . " WHERE active='1'" );
|
||||
$progress = new WPSC_Update_Progress( $total );
|
||||
|
||||
while (true) {
|
||||
$product_data = $wpdb->get_results( $wpdb->prepare( $sql, $offset, $limit ), ARRAY_A );
|
||||
$i = $offset;
|
||||
|
||||
if ( empty( $product_data ) )
|
||||
break;
|
||||
|
||||
foreach((array)$product_data as $product) {
|
||||
$wpsc_update->check_timeout( '</div>' );
|
||||
|
||||
$post_id = 0;
|
||||
|
||||
// if a product is in the middle of being converted
|
||||
if ( $post_created && ! empty( $post_created['original_id'] ) && $post_created['original_id'] == $product['id'] )
|
||||
$post_id = $post_created['post_id'];
|
||||
|
||||
$sku = old_get_product_meta($product['id'], 'sku', true);
|
||||
|
||||
if($post_id == 0) {
|
||||
$post_status = "publish";
|
||||
if($product['publish'] != 1) {
|
||||
$post_status = "draft";
|
||||
}
|
||||
|
||||
//check the product added time with the current time to make sure its not out - this aviods the future post status
|
||||
$product_added_time = strtotime($product['date_added']);
|
||||
$current_time = time();
|
||||
|
||||
$post_date = $product['date_added'];
|
||||
if ((int)$current_time < (int)$product_added_time)
|
||||
$post_date = date("Y-m-d H:i:s");
|
||||
|
||||
$product_post_values = array(
|
||||
'post_author' => $user_ID,
|
||||
'post_date' => $post_date,
|
||||
'post_content' => $product['description'],
|
||||
'post_excerpt' => $product['additional_description'],
|
||||
'post_title' => $product['name'],
|
||||
'post_status' => $post_status,
|
||||
'post_type' => "wpsc-product",
|
||||
'post_name' => $product['name']
|
||||
);
|
||||
|
||||
$product['order'] = $wpdb->get_var( $wpdb->prepare( "
|
||||
SELECT order FROM " . WPSC_TABLE_PRODUCT_ORDER . "
|
||||
WHERE product_id = %d
|
||||
" ), $product['id'] );
|
||||
|
||||
$product_post_values['menu_order'] = $product['order'];
|
||||
|
||||
$post_id = wp_insert_post($product_post_values);
|
||||
$post_created = array(
|
||||
'original_id' => $product['id'],
|
||||
'post_id' => $post_id,
|
||||
);
|
||||
set_transient( 'wpsc_update_current_product', $post_created, 604800 );
|
||||
}
|
||||
|
||||
$product_meta = $wpdb->get_results("
|
||||
SELECT IF( ( `custom` != 1 ),
|
||||
CONCAT( '_wpsc_', `meta_key` ) ,
|
||||
`meta_key`
|
||||
) AS `meta_key`,
|
||||
`meta_value`
|
||||
FROM `".WPSC_TABLE_PRODUCTMETA."`
|
||||
WHERE `product_id` = " . $product['id'] . "
|
||||
AND `meta_value` != ''", ARRAY_A);
|
||||
|
||||
$post_data = array();
|
||||
|
||||
foreach($product_meta as $k => $pm) :
|
||||
if($pm['meta_value'] == 'om')
|
||||
$pm['meta_value'] = 1;
|
||||
$pm['meta_value'] = maybe_unserialize($pm['meta_value']);
|
||||
if(strpos($pm['meta_key'], '_wpsc_') === 0)
|
||||
$post_data['_wpsc_product_metadata'][$pm['meta_key']] = $pm['meta_value'];
|
||||
else
|
||||
update_post_meta($post_id, $pm['meta_key'], $pm['meta_value']);
|
||||
endforeach;
|
||||
|
||||
|
||||
$post_data['_wpsc_original_id'] = (int)$product['id'];
|
||||
$post_data['_wpsc_price'] = (float)$product['price'];
|
||||
$post_data['_wpsc_special_price'] = $post_data['_wpsc_price'] - (float)$product['special_price']; // special price get stored in a weird way in 3.7.x
|
||||
$post_data['_wpsc_stock'] = (float)$product['quantity'];
|
||||
$post_data['_wpsc_is_donation'] = $product['donation'];
|
||||
$post_data['_wpsc_sku'] = $sku;
|
||||
if((bool)$product['quantity_limited'] != true) {
|
||||
$post_data['_wpsc_stock'] = false;
|
||||
}
|
||||
unset($post_data['_wpsc_limited_stock']);
|
||||
|
||||
$post_data['_wpsc_product_metadata']['is_stock_limited'] = (int)(bool)$product['quantity_limited'];
|
||||
|
||||
// Product Weight
|
||||
$post_data['_wpsc_product_metadata']['weight'] = wpsc_convert_weight($product['weight'], $product['weight_unit'], "pound", true);
|
||||
$post_data['_wpsc_product_metadata']['weight_unit'] = $product['weight_unit'];
|
||||
$post_data['_wpsc_product_metadata']['display_weight_as'] = $product['weight_unit'];
|
||||
|
||||
$post_data['_wpsc_product_metadata']['has_no_shipping'] = (int)(bool)$product['no_shipping'];
|
||||
$post_data['_wpsc_product_metadata']['shipping'] = array('local' => $product['pnp'], 'international' => $product['international_pnp']);
|
||||
|
||||
|
||||
$post_data['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$product['quantity_limited'];
|
||||
$post_data['_wpsc_product_metadata']['special'] = (int)(bool)$product['special'];
|
||||
if(isset($post_data['meta'])) {
|
||||
$post_data['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
|
||||
}
|
||||
$post_data['_wpsc_product_metadata']['no_shipping'] = (int)(bool)$product['no_shipping'];
|
||||
|
||||
foreach($post_data as $meta_key => $meta_value) {
|
||||
// prefix all meta keys with _wpsc_
|
||||
update_post_meta($post_id, $meta_key, $meta_value);
|
||||
}
|
||||
|
||||
// get the wordpress upload directory data
|
||||
$wp_upload_dir_data = wp_upload_dir();
|
||||
$wp_upload_basedir = $wp_upload_dir_data['basedir'];
|
||||
|
||||
$category_ids = array();
|
||||
$category_data = $wpdb->get_col("SELECT `category_id` FROM `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` WHERE `product_id` IN ('{$product['id']}')");
|
||||
foreach($category_data as $old_category_id) {
|
||||
$category_ids[] = wpsc_get_meta($old_category_id, 'category_id', 'wpsc_old_category');
|
||||
|
||||
}
|
||||
wp_set_product_categories($post_id, $category_ids);
|
||||
|
||||
$product_data = get_post($post_id);
|
||||
$image_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_IMAGES."` WHERE `product_id` IN ('{$product['id']}') ORDER BY `image_order` ASC", ARRAY_A);
|
||||
foreach((array)$image_data as $image_row) {
|
||||
$wpsc_update->check_timeout( '</div>' );
|
||||
// Get the image path info
|
||||
$image_pathinfo = pathinfo($image_row['image']);
|
||||
|
||||
// use the path info to clip off the file extension
|
||||
$image_name = basename($image_pathinfo['basename'], ".{$image_pathinfo['extension']}");
|
||||
|
||||
// construct the full image path
|
||||
$full_image_path = WPSC_IMAGE_DIR.$image_row['image'];
|
||||
$attached_file_path = str_replace($wp_upload_basedir."/", '', $full_image_path);
|
||||
$upload_dir = wp_upload_dir();
|
||||
$new_path = $upload_dir['path'].'/'.$image_name.'.'.$image_pathinfo['extension'];
|
||||
if(is_file($full_image_path)){
|
||||
copy($full_image_path, $new_path);
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
// construct the full image url
|
||||
$subdir = $upload_dir['subdir'].'/'.$image_name.'.'.$image_pathinfo['extension'];
|
||||
$subdir = substr($subdir , 1);
|
||||
$attachment_id = (int)$wpdb->get_var("SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_title` IN('$image_name') AND `post_parent` IN('$post_id') LIMIT 1");
|
||||
|
||||
// get the image MIME type
|
||||
$mime_type_data = wpsc_get_mimetype($full_image_path, true);
|
||||
if((int)$attachment_id == 0 ) {
|
||||
// construct the image data array
|
||||
$image_post_values = array(
|
||||
'post_author' => $user_ID,
|
||||
'post_parent' => $post_id,
|
||||
'post_date' => $product_data->post_date,
|
||||
'post_content' => $image_name,
|
||||
'post_title' => $image_name,
|
||||
'post_status' => "inherit",
|
||||
'post_type' => "attachment",
|
||||
'post_name' => sanitize_title($image_name),
|
||||
'post_mime_type' => $mime_type_data['mime_type'],
|
||||
'menu_order' => absint($image_row['image_order']),
|
||||
'guid' => $new_path
|
||||
);
|
||||
$attachment_id = wp_insert_post($image_post_values);
|
||||
}
|
||||
|
||||
update_attached_file( $attachment_id, $new_path );
|
||||
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $new_path ) );
|
||||
}
|
||||
$i ++;
|
||||
$progress->update( $i );
|
||||
set_transient( 'wpsc_update_product_offset', $i, 604800 );
|
||||
}
|
||||
|
||||
$offset += $limit;
|
||||
}
|
||||
//Just throwing the payment gateway update in here because it doesn't really warrant it's own function :)
|
||||
$custom_gateways = get_option('custom_gateway_options');
|
||||
array_walk($custom_gateways, "wpec_update_gateway");
|
||||
update_option('custom_gateway_options', $custom_gateways);
|
||||
}
|
||||
|
||||
function wpec_update_gateway(&$value,$key) {
|
||||
if ( $value == "testmode" )
|
||||
$value = "wpsc_merchant_testmode";
|
||||
if ( $value == "paypal_certified" )
|
||||
$value = "wpsc_merchant_paypal_express";
|
||||
if ( $value == "paypal_multiple" )
|
||||
$value = "wpsc_merchant_paypal_standard";
|
||||
if ( $value == "paypal_pro" )
|
||||
$value = "wpsc_merchant_paypal_pro";
|
||||
|
||||
}
|
||||
function wpsc_convert_variation_combinations() {
|
||||
global $wpdb, $user_ID, $current_version_number;
|
||||
$wpsc_update = WPSC_Update::get_instance();
|
||||
remove_filter( 'get_terms', 'wpsc_get_terms_category_sort_filter' );
|
||||
if ( ! $offset = get_transient( 'wpsc_update_variation_comb_offset' ) )
|
||||
$offset = 0;
|
||||
$limit = 150;
|
||||
wp_defer_term_counting( true );
|
||||
$sql = "SELECT * FROM {$wpdb->posts} WHERE post_type = 'wpsc-product' AND post_parent = 0 LIMIT %d, %d";
|
||||
|
||||
$total = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = 'wpsc-product' AND post_parent = 0" );
|
||||
$progress = new WPSC_Update_Progress( $total );
|
||||
|
||||
while ( true ) {
|
||||
// get the posts
|
||||
// I use a direct SQL query here because the get_posts function sometimes does not function for a reason that is not clear.
|
||||
$posts = $wpdb->get_results( $wpdb->prepare( $sql, $offset, $limit ) );
|
||||
$i = $offset;
|
||||
if ( empty( $posts ) )
|
||||
break;
|
||||
|
||||
foreach((array)$posts as $post) {
|
||||
if ( ! $child_products = get_transient( 'wpsc_update_current_child_products' ) )
|
||||
$child_products = array();
|
||||
|
||||
$wpsc_update->check_timeout();
|
||||
$base_product_terms = array();
|
||||
//create a post template
|
||||
$child_product_template = array(
|
||||
'post_author' => $user_ID,
|
||||
'post_content' => $post->post_content,
|
||||
'post_excerpt' => $post->post_excerpt,
|
||||
'post_title' => $post->post_title,
|
||||
'post_status' => 'inherit',
|
||||
'post_type' => "wpsc-product",
|
||||
'post_name' => $post->post_title,
|
||||
'post_parent' => $post->ID
|
||||
);
|
||||
|
||||
// select the original product ID
|
||||
$original_id = get_post_meta($post->ID, '_wpsc_original_id', true);
|
||||
$parent_stock = get_post_meta($post->ID, '_wpsc_stock', true);
|
||||
|
||||
// select the variation set associations
|
||||
$variation_set_associations = $wpdb->get_col("SELECT `variation_id` FROM ".WPSC_TABLE_VARIATION_ASSOC." WHERE `associated_id` = '{$original_id}'");
|
||||
// select the variation associations if the count of variation sets is greater than zero
|
||||
if(($original_id > 0) && (count($variation_set_associations) > 0)) {
|
||||
$variation_associations = $wpdb->get_col("SELECT `value_id` FROM ".WPSC_TABLE_VARIATION_VALUES_ASSOC." WHERE `product_id` = '{$original_id}' AND `variation_id` IN(".implode(", ", $variation_set_associations).") AND `visible` IN ('1')");
|
||||
} else {
|
||||
// otherwise, we have no active variations, skip to the next product
|
||||
$i++;
|
||||
$progress->update( $i );
|
||||
set_transient( 'wpsc_update_variation_comb_offset', $i, 604800 );
|
||||
continue;
|
||||
}
|
||||
|
||||
$variation_set_id_sql = "SELECT meta_value FROM " . WPSC_TABLE_META . " WHERE object_type='wpsc_variation_set' AND object_id IN (" . implode( ',', $variation_set_associations ) . ") AND meta_key = 'variation_set_id'";
|
||||
|
||||
$variation_set_terms = $wpdb->get_col( $variation_set_id_sql );
|
||||
|
||||
$variation_associations_sql = "SELECT meta_value FROM " . WPSC_TABLE_META . " WHERE object_type='wpsc_variation' AND object_id IN (" . implode( ',', $variation_associations ) . ") AND meta_key = 'variation_id'";
|
||||
|
||||
$variation_associations_terms = $wpdb->get_col( $variation_associations_sql );
|
||||
|
||||
$base_product_terms = array_merge( $base_product_terms, $variation_set_terms, $variation_associations_terms );
|
||||
|
||||
// Now that we have the term IDs, we need to retrieve the slugs, as wp_set_object_terms will not use IDs in the way we want
|
||||
// If we pass IDs into wp_set_object_terms, it creates terms using the ID as the name.
|
||||
$parent_product_terms = get_terms('wpsc-variation', array(
|
||||
'hide_empty' => 0,
|
||||
'include' => implode(",", $base_product_terms),
|
||||
'orderby' => 'parent'
|
||||
));
|
||||
$base_product_term_slugs = array();
|
||||
foreach($parent_product_terms as $parent_product_term) {
|
||||
$base_product_term_slugs[] = $parent_product_term->slug;
|
||||
|
||||
}
|
||||
|
||||
wp_set_object_terms($post->ID, $base_product_term_slugs, 'wpsc-variation');
|
||||
|
||||
// select all variation "products"
|
||||
$variation_items = $wpdb->get_results("SELECT * FROM ".WPSC_TABLE_VARIATION_PROPERTIES." WHERE `product_id` = '{$original_id}'");
|
||||
|
||||
foreach((array)$variation_items as $variation_item) {
|
||||
$wpsc_update->check_timeout();
|
||||
// initialize the requisite arrays to empty
|
||||
$variation_ids = array();
|
||||
$term_data = array(
|
||||
'ids' => array(),
|
||||
'slugs' => array(),
|
||||
'names' => array(),
|
||||
);
|
||||
// make a temporary copy of the product teplate
|
||||
$product_values = $child_product_template;
|
||||
|
||||
// select all values this "product" is associated with, then loop through them, getting the term id of the variation using the value ID
|
||||
$variation_associations_combinations = $wpdb->get_results("SELECT * FROM ".WPSC_TABLE_VARIATION_COMBINATIONS." WHERE `priceandstock_id` = '{$variation_item->id}'");
|
||||
foreach((array)$variation_associations_combinations as $association) {
|
||||
$variation_id = (int)wpsc_get_meta($association->value_id, 'variation_id', 'wpsc_variation');
|
||||
// discard any values that are null, as they break the selecting of the terms
|
||||
if($variation_id > 0 && in_array($association->value_id, $variation_associations) ) {
|
||||
$variation_ids[] = $variation_id;
|
||||
}
|
||||
}
|
||||
|
||||
// if we have more than zero remaining terms, get the term data, then loop through it to convert it to a more useful set of arrays.
|
||||
if(count($variation_ids) > 0 && ( count($variation_set_associations) == count($variation_ids) ) ) {
|
||||
$combination_terms = get_terms('wpsc-variation', array(
|
||||
'hide_empty' => 0,
|
||||
'include' => implode(",", $variation_ids),
|
||||
));
|
||||
|
||||
foreach($combination_terms as $term) {
|
||||
$term_data['ids'][] = $term->term_id;
|
||||
$term_data['slugs'][] = $term->slug;
|
||||
$term_data['names'][] = $term->name;
|
||||
}
|
||||
|
||||
$product_values['post_title'] .= " (".implode(", ", $term_data['names']).")";
|
||||
$product_values['post_name'] = sanitize_title($product_values['post_title']);
|
||||
|
||||
$selected_post = get_posts(array(
|
||||
'name' => $product_values['post_name'],
|
||||
'post_parent' => $post->ID,
|
||||
'post_type' => "wpsc-product",
|
||||
'post_status' => 'all',
|
||||
'suppress_filters' => true
|
||||
));
|
||||
|
||||
$selected_post = array_shift($selected_post);
|
||||
$key = md5( $post->ID . ':' . count( $term_data['ids'] ) . ':' . implode(',', $term_data['ids'] ) );
|
||||
$child_product_id = false;
|
||||
|
||||
if ( ! empty( $child_products[$key] ) )
|
||||
$child_product_id = $child_products[$key];
|
||||
|
||||
$post_data = array();
|
||||
$post_data['_wpsc_price'] = (float)$variation_item->price;
|
||||
$post_data['_wpsc_stock'] = (float)$variation_item->stock;
|
||||
if( !is_numeric( $parent_stock ) )
|
||||
$post_data['_wpsc_stock'] = false;
|
||||
|
||||
$post_data['_wpsc_original_variation_id'] = (float)$variation_item->id;
|
||||
|
||||
// Product Weight
|
||||
$post_data['_wpsc_product_metadata']['weight'] = wpsc_convert_weight($variation_item->weight, $variation_item->weight_unit, "pound", true);
|
||||
$post_data['_wpsc_product_metadata']['display_weight_as'] = $variation_item->weight_unit;
|
||||
$post_data['_wpsc_product_metadata']['weight_unit'] = $variation_item->weight_unit;
|
||||
|
||||
$already_exists = true;
|
||||
|
||||
if ( ! empty( $selected_post ) && $selected_post->ID != $child_product_id ) {
|
||||
$child_product_id = $selected_post->ID;
|
||||
} elseif ( empty( $child_product_id ) ) {
|
||||
$child_product_id = wp_insert_post( $product_values );
|
||||
$already_exists = false;
|
||||
}
|
||||
|
||||
if($child_product_id > 0) {
|
||||
|
||||
foreach($post_data as $meta_key => $meta_value) {
|
||||
// prefix all meta keys with _wpsc_
|
||||
update_post_meta($child_product_id, $meta_key, $meta_value);
|
||||
}
|
||||
|
||||
|
||||
wp_set_object_terms($child_product_id, $term_data['slugs'], 'wpsc-variation');
|
||||
if ( ! $already_exists ) {
|
||||
$child_products[$key] = $child_product_id;
|
||||
set_transient( 'wpsc_update_current_child_products', $child_products, 604800 );
|
||||
}
|
||||
}
|
||||
|
||||
unset($term_data);
|
||||
}
|
||||
|
||||
}
|
||||
$i++;
|
||||
$progress->update( $i );
|
||||
set_transient( 'wpsc_update_variation_comb_offset', $i, 604800 );
|
||||
delete_transient( 'wpsc_update_current_child_products' );
|
||||
}
|
||||
|
||||
$offset += $limit;
|
||||
|
||||
}
|
||||
delete_option("wpsc-variation_children");
|
||||
_get_term_hierarchy('wpsc-variation');
|
||||
delete_option("wpsc_product_category_children");
|
||||
_get_term_hierarchy('wpsc_product_category');
|
||||
}
|
||||
|
||||
function wpsc_update_files() {
|
||||
global $wpdb, $user_ID;
|
||||
$product_files = $wpdb->get_results("SELECT * FROM ".WPSC_TABLE_PRODUCT_FILES."");
|
||||
$wpsc_update = WPSC_Update::get_instance();
|
||||
|
||||
foreach($product_files as $product_file) {
|
||||
$wpsc_update->check_timeout();
|
||||
$variation_post_ids = array();
|
||||
if(!empty($product_file->product_id)){
|
||||
$product_post_id = (int)$wpdb->get_var($wpdb->prepare( "SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = %s AND `meta_value` = %d LIMIT 1", '_wpsc_original_id', $product_file->product_id ));
|
||||
}else{
|
||||
$product_post_id = (int)$wpdb->get_var("SELECT `id` FROM ".WPSC_TABLE_PRODUCT_LIST." WHERE file=".$product_file->id);
|
||||
$product_post_id = (int)$wpdb->get_var($wpdb->prepare( "SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = %s AND `meta_value` = %d LIMIT 1", '_wpsc_original_id', $product_post_id ));
|
||||
}
|
||||
$variation_items = $wpdb->get_col("SELECT `id` FROM ".WPSC_TABLE_VARIATION_PROPERTIES." WHERE `file` = '{$product_file->id}'");
|
||||
|
||||
if(count($variation_items) > 0) {
|
||||
$variation_post_ids = $wpdb->get_col("SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = '_wpsc_original_variation_id' AND `meta_value` IN(".implode(", ", $variation_items).")");
|
||||
}
|
||||
|
||||
$attachment_template = array(
|
||||
'post_mime_type' => $product_file->mimetype,
|
||||
'post_title' => $product_file->filename,
|
||||
'post_name' => $product_file->idhash,
|
||||
'post_content' => '',
|
||||
'post_parent' => $product_post_id,
|
||||
'post_type' => "wpsc-product-file",
|
||||
'post_status' => 'inherit'
|
||||
);
|
||||
|
||||
$file_id = wpsc_get_meta($product_file->id, '_new_file_id', 'wpsc_files');
|
||||
|
||||
if($file_id == null && count($variation_post_ids) == 0) {
|
||||
$file_data = $attachment_template;
|
||||
$file_data['post_parent'] = $product_post_id;
|
||||
$new_file_id = wp_insert_post($file_data);
|
||||
wpsc_update_meta($product_file->id, '_new_file_id', $new_file_id, 'wpsc_files');
|
||||
}
|
||||
if(count($variation_post_ids) > 0) {
|
||||
foreach($variation_post_ids as $variation_post_id) {
|
||||
$old_file_id = get_product_meta($variation_post_id, 'old_file_id', true);
|
||||
if($old_file_id == null) {
|
||||
$file_data = $attachment_template;
|
||||
$file_data['post_parent'] = $variation_post_id;
|
||||
$new_file_id = wp_insert_post($file_data);
|
||||
update_product_meta($variation_post_id, 'old_file_id', $product_file->id, 'wpsc_files');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($product_file->preview)){
|
||||
$preview_template = array(
|
||||
'post_mime_type' => $product_file->preview_mimetype,
|
||||
'post_title' => $product_file->preview,
|
||||
'post_name' => $product_file->filename,
|
||||
'post_content' => '',
|
||||
'post_parent' => $new_file_id,
|
||||
'post_type' => "wpsc-product-preview",
|
||||
'post_status' => 'inherit'
|
||||
);
|
||||
wp_insert_post($preview_template);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$download_ids = $wpdb->get_col("SELECT `id` FROM ".WPSC_TABLE_DOWNLOAD_STATUS."");
|
||||
foreach($download_ids as $download_id) {
|
||||
if(wpsc_get_meta($download_id, '_is_legacy', 'wpsc_downloads') !== 'false') {
|
||||
wpsc_update_meta($download_id, '_is_legacy', 'true', 'wpsc_downloads');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_update_database() {
|
||||
global $wpdb;
|
||||
|
||||
$result = $wpdb->get_results("SHOW COLUMNS FROM ". WPSC_TABLE_PURCHASE_LOGS."", ARRAY_A);
|
||||
if (!$result) {
|
||||
echo 'Could not run query: ' . mysql_error();
|
||||
exit;
|
||||
}
|
||||
foreach($result as $row_key=>$value) {
|
||||
$has_taxes = ($value["Field"] == "wpec_taxes_total" || $value["Field"] == "wpec_taxes_rate") ? true: false;
|
||||
}
|
||||
if (!$has_taxes) {
|
||||
$add_fields = $wpdb->query($wpdb->prepare("ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_total decimal(11,2)"));
|
||||
$add_fields = $wpdb->query($wpdb->prepare("ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_rate decimal(11,2)"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The Old Get Product Meta for 3.7 Tables used in converting Products to Posts
|
||||
*/
|
||||
|
||||
function old_get_product_meta($product_id, $key, $single = false) {
|
||||
global $wpdb, $post_meta_cache, $blog_id;
|
||||
$product_id = (int)$product_id;
|
||||
$meta_values = false;
|
||||
if($product_id > 0) {
|
||||
$meta_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `meta_key` IN('$key') AND `product_id` = '$product_id' LIMIT 1");
|
||||
//exit($meta_id);
|
||||
if(is_numeric($meta_id) && ($meta_id > 0)) {
|
||||
if($single != false) {
|
||||
$meta_values = maybe_unserialize($wpdb->get_var("SELECT `meta_value` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `meta_key` IN('$key') AND `product_id` = '$product_id' LIMIT 1"));
|
||||
} else {
|
||||
$meta_values = $wpdb->get_col("SELECT `meta_value` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `meta_key` IN('$key') AND `product_id` = '$product_id'");
|
||||
$meta_values = array_map('maybe_unserialize', $meta_values);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_array($meta_values) && (count($meta_values) == 1)) {
|
||||
return array_pop($meta_values);
|
||||
} else {
|
||||
return $meta_values;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -1,48 +0,0 @@
|
||||
// Copyright (c) 2005 Timothy R. Morgan
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
// mini/ajax.js - http://timmorgan.org/mini
|
||||
// var fvd = 0;
|
||||
function ajax_item(e){if(typeof e=='string')e=document.getElementById(e);return e};
|
||||
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
|
||||
|
||||
ajax={};
|
||||
ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
|
||||
ajax.serialize=function(f)
|
||||
{
|
||||
var g=function(n)
|
||||
{
|
||||
return f.getElementsByTagName(n)
|
||||
};
|
||||
var nv=function(e)
|
||||
{
|
||||
if(e.name)
|
||||
{
|
||||
return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);
|
||||
} else {return '';}
|
||||
};
|
||||
var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');
|
||||
};
|
||||
|
||||
ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseText)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
|
||||
ajax.get=function(url,func){ajax.send(url,func,'GET')};
|
||||
ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText};
|
||||
ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
|
||||
ajax.update=function(url,elm){var e=ajax_item(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
|
||||
ajax.submit=function(url,elm,frm){var e=ajax_item(elm);var f=function(r){e.innerHTML=r};ajax.post(url,f,ajax.serialize(frm))};
|
||||
@ -1,325 +0,0 @@
|
||||
/*
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* $LastChangedDate$
|
||||
* $Rev$
|
||||
*/
|
||||
|
||||
jQuery.fn._height = jQuery.fn.height;
|
||||
jQuery.fn._width = jQuery.fn.width;
|
||||
|
||||
/**
|
||||
* If used on document, returns the document's height (innerHeight)
|
||||
* If used on window, returns the viewport's (window) height
|
||||
* See core docs on height() to see what happens when used on an element.
|
||||
*
|
||||
* @example $("#testdiv").height()
|
||||
* @result 200
|
||||
*
|
||||
* @example $(document).height()
|
||||
* @result 800
|
||||
*
|
||||
* @example $(window).height()
|
||||
* @result 400
|
||||
*
|
||||
* @name height
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.height = function() {
|
||||
if ( this[0] == window )
|
||||
return self.innerHeight ||
|
||||
jQuery.boxModel && document.documentElement.clientHeight ||
|
||||
document.body.clientHeight;
|
||||
|
||||
if ( this[0] == document )
|
||||
return Math.max( document.body.scrollHeight, document.body.offsetHeight );
|
||||
|
||||
return this._height(arguments[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* If used on document, returns the document's width (innerWidth)
|
||||
* If used on window, returns the viewport's (window) width
|
||||
* See core docs on height() to see what happens when used on an element.
|
||||
*
|
||||
* @example $("#testdiv").width()
|
||||
* @result 200
|
||||
*
|
||||
* @example $(document).width()
|
||||
* @result 800
|
||||
*
|
||||
* @example $(window).width()
|
||||
* @result 400
|
||||
*
|
||||
* @name width
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.width = function() {
|
||||
if ( this[0] == window )
|
||||
return self.innerWidth ||
|
||||
jQuery.boxModel && document.documentElement.clientWidth ||
|
||||
document.body.clientWidth;
|
||||
|
||||
if ( this[0] == document )
|
||||
return Math.max( document.body.scrollWidth, document.body.offsetWidth );
|
||||
|
||||
return this._width(arguments[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the inner height value (without border) for the first matched element.
|
||||
* If used on document, returns the document's height (innerHeight)
|
||||
* If used on window, returns the viewport's (window) height
|
||||
*
|
||||
* @example $("#testdiv").innerHeight()
|
||||
* @result 800
|
||||
*
|
||||
* @name innerHeight
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.innerHeight = function() {
|
||||
return this[0] == window || this[0] == document ?
|
||||
this.height() :
|
||||
this.css('display') != 'none' ?
|
||||
this[0].offsetHeight - (parseInt(this.css("borderTopWidth")) || 0) - (parseInt(this.css("borderBottomWidth")) || 0) :
|
||||
this.height() + (parseInt(this.css("paddingTop")) || 0) + (parseInt(this.css("paddingBottom")) || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the inner width value (without border) for the first matched element.
|
||||
* If used on document, returns the document's Width (innerWidth)
|
||||
* If used on window, returns the viewport's (window) width
|
||||
*
|
||||
* @example $("#testdiv").innerWidth()
|
||||
* @result 1000
|
||||
*
|
||||
* @name innerWidth
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.innerWidth = function() {
|
||||
return this[0] == window || this[0] == document ?
|
||||
this.width() :
|
||||
this.css('display') != 'none' ?
|
||||
this[0].offsetWidth - (parseInt(this.css("borderLeftWidth")) || 0) - (parseInt(this.css("borderRightWidth")) || 0) :
|
||||
this.height() + (parseInt(this.css("paddingLeft")) || 0) + (parseInt(this.css("paddingRight")) || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the outer height value (including border) for the first matched element.
|
||||
* Cannot be used on document or window.
|
||||
*
|
||||
* @example $("#testdiv").outerHeight()
|
||||
* @result 1000
|
||||
*
|
||||
* @name outerHeight
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.outerHeight = function() {
|
||||
return this[0] == window || this[0] == document ?
|
||||
this.height() :
|
||||
this.css('display') != 'none' ?
|
||||
this[0].offsetHeight :
|
||||
this.height() + (parseInt(this.css("borderTopWidth")) || 0) + (parseInt(this.css("borderBottomWidth")) || 0)
|
||||
+ (parseInt(this.css("paddingTop")) || 0) + (parseInt(this.css("paddingBottom")) || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the outer width value (including border) for the first matched element.
|
||||
* Cannot be used on document or window.
|
||||
*
|
||||
* @example $("#testdiv").outerWidth()
|
||||
* @result 1000
|
||||
*
|
||||
* @name outerWidth
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.outerWidth = function() {
|
||||
return this[0] == window || this[0] == document ?
|
||||
this.width() :
|
||||
this.css('display') != 'none' ?
|
||||
this[0].offsetWidth :
|
||||
this.height() + (parseInt(this.css("borderLeftWidth")) || 0) + (parseInt(this.css("borderRightWidth")) || 0)
|
||||
+ (parseInt(this.css("paddingLeft")) || 0) + (parseInt(this.css("paddingRight")) || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns how many pixels the user has scrolled to the right (scrollLeft).
|
||||
* Works on containers with overflow: auto and window/document.
|
||||
*
|
||||
* @example $("#testdiv").scrollLeft()
|
||||
* @result 100
|
||||
*
|
||||
* @name scrollLeft
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.scrollLeft = function() {
|
||||
if ( this[0] == window || this[0] == document )
|
||||
return self.pageXOffset ||
|
||||
jQuery.boxModel && document.documentElement.scrollLeft ||
|
||||
document.body.scrollLeft;
|
||||
|
||||
return this[0].scrollLeft;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns how many pixels the user has scrolled to the bottom (scrollTop).
|
||||
* Works on containers with overflow: auto and window/document.
|
||||
*
|
||||
* @example $("#testdiv").scrollTop()
|
||||
* @result 100
|
||||
*
|
||||
* @name scrollTop
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.scrollTop = function() {
|
||||
if ( this[0] == window || this[0] == document )
|
||||
return self.pageYOffset ||
|
||||
jQuery.boxModel && document.documentElement.scrollTop ||
|
||||
document.body.scrollTop;
|
||||
|
||||
return this[0].scrollTop;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the location of the element in pixels from the top left corner of the viewport.
|
||||
*
|
||||
* For accurate readings make sure to use pixel values for margins, borders and padding.
|
||||
*
|
||||
* @example $("#testdiv").offset()
|
||||
* @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 }
|
||||
*
|
||||
* @example $("#testdiv").offset({ scroll: false })
|
||||
* @result { top: 90, left: 90 }
|
||||
*
|
||||
* @example var offset = {}
|
||||
* $("#testdiv").offset({ scroll: false }, offset)
|
||||
* @result offset = { top: 90, left: 90 }
|
||||
*
|
||||
* @name offset
|
||||
* @param Object options A hash of options describing what should be included in the final calculations of the offset.
|
||||
* The options include:
|
||||
* margin: Should the margin of the element be included in the calculations? True by default.
|
||||
* If set to false the margin of the element is subtracted from the total offset.
|
||||
* border: Should the border of the element be included in the calculations? True by default.
|
||||
* If set to false the border of the element is subtracted from the total offset.
|
||||
* padding: Should the padding of the element be included in the calculations? False by default.
|
||||
* If set to true the padding of the element is added to the total offset.
|
||||
* scroll: Should the scroll offsets of the parent elements be included in the calculations?
|
||||
* True by default. When true, it adds the total scroll offsets of all parents to the
|
||||
* total offset and also adds two properties to the returned object, scrollTop and
|
||||
* scrollLeft. If set to false the scroll offsets of parent elements are ignored.
|
||||
* If scroll offsets are not needed, set to false to get a performance boost.
|
||||
* @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
|
||||
* chain will not be broken and the result will be assigned to this object.
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
* @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*/
|
||||
jQuery.fn.offset = function(options, returnObject) {
|
||||
var x = 0, y = 0, elem = this[0], parent = this[0], absparent=false, relparent=false, op, sl = 0, st = 0, options = jQuery.extend({ margin: true, border: true, padding: false, scroll: true }, options || {});
|
||||
do {
|
||||
if(parent == null)
|
||||
{
|
||||
// fix by Thomas Howard , stops some javascript errors with an unknown original cause, somehow parent sometimes ends up empty
|
||||
return null;
|
||||
}
|
||||
x += parent.offsetLeft || 0;
|
||||
y += parent.offsetTop || 0;
|
||||
|
||||
// Mozilla and IE do not add the border
|
||||
if (jQuery.browser.mozilla || jQuery.browser.msie) {
|
||||
// get borders
|
||||
var bt = parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
|
||||
var bl = parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
|
||||
|
||||
// add borders to offset
|
||||
x += bl;
|
||||
y += bt;
|
||||
|
||||
// Mozilla removes the border if the parent has overflow property other than visible
|
||||
if (jQuery.browser.mozilla && parent != elem && jQuery.css(parent, 'overflow') != 'visible') {
|
||||
x += bl;
|
||||
y += bt;
|
||||
}
|
||||
|
||||
// Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
|
||||
if (jQuery.css(parent, 'position') == 'absolute') absparent = true;
|
||||
// IE does not include the border on the body if an element is position static and without an absolute or relative parent
|
||||
if (jQuery.css(parent, 'position') == 'relative') relparent = true;
|
||||
}
|
||||
|
||||
if (options.scroll) {
|
||||
// Need to get scroll offsets in-between offsetParents
|
||||
op = parent.offsetParent;
|
||||
do {
|
||||
sl += parent.scrollLeft || 0;
|
||||
st += parent.scrollTop || 0;
|
||||
|
||||
parent = parent.parentNode;
|
||||
|
||||
// Mozilla removes the border if the parent has overflow property other than visible
|
||||
if (jQuery.browser.mozilla && parent != elem && parent != op && jQuery.css(parent, 'overflow') != 'visible') {
|
||||
x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
|
||||
y += parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
|
||||
}
|
||||
} while (op && parent != op);
|
||||
} else
|
||||
parent = parent.offsetParent;
|
||||
|
||||
if (parent && (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html')) {
|
||||
// Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative
|
||||
if ((jQuery.browser.safari || (jQuery.browser.msie && jQuery.boxModel)) && jQuery.css(elem, 'position') != 'absolute') {
|
||||
x += parseInt(jQuery.css(parent, 'marginLeft')) || 0;
|
||||
y += parseInt(jQuery.css(parent, 'marginTop')) || 0;
|
||||
}
|
||||
// Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
|
||||
// IE does not include the border on the body if an element is positioned static and without an absolute or relative parent
|
||||
if ( (jQuery.browser.mozilla && !absparent) ||
|
||||
(jQuery.browser.msie && jQuery.css(elem, 'position') == 'static' && (!relparent || !absparent)) ) {
|
||||
x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
|
||||
y += parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
|
||||
}
|
||||
break; // Exit the loop
|
||||
}
|
||||
} while (parent);
|
||||
|
||||
if ( !options.margin) {
|
||||
x -= parseInt(jQuery.css(elem, 'marginLeft')) || 0;
|
||||
y -= parseInt(jQuery.css(elem, 'marginTop')) || 0;
|
||||
}
|
||||
|
||||
// Safari and Opera do not add the border for the element
|
||||
if ( options.border && (jQuery.browser.safari || jQuery.browser.opera) ) {
|
||||
x += parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
|
||||
y += parseInt(jQuery.css(elem, 'borderTopWidth')) || 0;
|
||||
} else if ( !options.border && !(jQuery.browser.safari || jQuery.browser.opera) ) {
|
||||
x -= parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
|
||||
y -= parseInt(jQuery.css(elem, 'borderTopWidth')) || 0;
|
||||
}
|
||||
|
||||
if ( options.padding ) {
|
||||
x += parseInt(jQuery.css(elem, 'paddingLeft')) || 0;
|
||||
y += parseInt(jQuery.css(elem, 'paddingTop')) || 0;
|
||||
}
|
||||
|
||||
// Opera thinks offset is scroll offset for display: inline elements
|
||||
if (options.scroll && jQuery.browser.opera && jQuery.css(elem, 'display') == 'inline') {
|
||||
sl -= elem.scrollLeft || 0;
|
||||
st -= elem.scrollTop || 0;
|
||||
}
|
||||
|
||||
var returnValue = options.scroll ? { top: y - st, left: x - sl, scrollTop: st, scrollLeft: sl }
|
||||
: { top: y, left: x };
|
||||
|
||||
if (returnObject) { jQuery.extend(returnObject, returnValue); return this; }
|
||||
else { return returnValue; }
|
||||
};
|
||||
@ -1,251 +0,0 @@
|
||||
/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Version: 1.0.3
|
||||
* Requires jQuery 1.1.3+
|
||||
* Docs: http://docs.jquery.com/Plugins/livequery
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.extend($.fn, {
|
||||
livequery: function(type, fn, fn2) {
|
||||
var self = this, q;
|
||||
|
||||
// Handle different call patterns
|
||||
if ($.isFunction(type))
|
||||
fn2 = fn, fn = type, type = undefined;
|
||||
|
||||
// See if Live Query already exists
|
||||
$.each( $.livequery.queries, function(i, query) {
|
||||
if ( self.selector == query.selector && self.context == query.context &&
|
||||
type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
|
||||
// Found the query, exit the each loop
|
||||
return (q = query) && false;
|
||||
});
|
||||
|
||||
// Create new Live Query if it wasn't found
|
||||
q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
|
||||
|
||||
// Make sure it is running
|
||||
q.stopped = false;
|
||||
|
||||
// Run it immediately for the first time
|
||||
q.run();
|
||||
|
||||
// Contnue the chain
|
||||
return this;
|
||||
},
|
||||
|
||||
expire: function(type, fn, fn2) {
|
||||
var self = this;
|
||||
|
||||
// Handle different call patterns
|
||||
if ($.isFunction(type))
|
||||
fn2 = fn, fn = type, type = undefined;
|
||||
|
||||
// Find the Live Query based on arguments and stop it
|
||||
$.each( $.livequery.queries, function(i, query) {
|
||||
if ( self.selector == query.selector && self.context == query.context &&
|
||||
(!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
|
||||
$.livequery.stop(query.id);
|
||||
});
|
||||
|
||||
// Continue the chain
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
$.livequery = function(selector, context, type, fn, fn2) {
|
||||
this.selector = selector;
|
||||
this.context = context || document;
|
||||
this.type = type;
|
||||
this.fn = fn;
|
||||
this.fn2 = fn2;
|
||||
this.elements = [];
|
||||
this.stopped = false;
|
||||
|
||||
// The id is the index of the Live Query in $.livequery.queries
|
||||
this.id = $.livequery.queries.push(this)-1;
|
||||
|
||||
// Mark the functions for matching later on
|
||||
fn.$lqguid = fn.$lqguid || $.livequery.guid++;
|
||||
if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
|
||||
|
||||
// Return the Live Query
|
||||
return this;
|
||||
};
|
||||
|
||||
$.livequery.prototype = {
|
||||
stop: function() {
|
||||
var query = this;
|
||||
|
||||
if ( this.type )
|
||||
// Unbind all bound events
|
||||
this.elements.unbind(this.type, this.fn);
|
||||
else if (this.fn2)
|
||||
// Call the second function for all matched elements
|
||||
this.elements.each(function(i, el) {
|
||||
query.fn2.apply(el);
|
||||
});
|
||||
|
||||
// Clear out matched elements
|
||||
this.elements = [];
|
||||
|
||||
// Stop the Live Query from running until restarted
|
||||
this.stopped = true;
|
||||
},
|
||||
|
||||
run: function() {
|
||||
// Short-circuit if stopped
|
||||
if ( this.stopped ) return;
|
||||
var query = this;
|
||||
|
||||
var oEls = this.elements,
|
||||
els = $(this.selector, this.context),
|
||||
nEls = els.not(oEls);
|
||||
|
||||
// Set elements to the latest set of matched elements
|
||||
this.elements = els;
|
||||
|
||||
if (this.type) {
|
||||
// Bind events to newly matched elements
|
||||
nEls.bind(this.type, this.fn);
|
||||
|
||||
// Unbind events to elements no longer matched
|
||||
if (oEls.length > 0)
|
||||
$.each(oEls, function(i, el) {
|
||||
if ( $.inArray(el, els) < 0 )
|
||||
$.event.remove(el, query.type, query.fn);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// Call the first function for newly matched elements
|
||||
nEls.each(function() {
|
||||
query.fn.apply(this);
|
||||
});
|
||||
|
||||
// Call the second function for elements no longer matched
|
||||
if ( this.fn2 && oEls.length > 0 )
|
||||
$.each(oEls, function(i, el) {
|
||||
if ( $.inArray(el, els) < 0 )
|
||||
query.fn2.apply(el);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.extend($.livequery, {
|
||||
guid: 0,
|
||||
queries: [],
|
||||
queue: [],
|
||||
running: false,
|
||||
timeout: null,
|
||||
|
||||
checkQueue: function() {
|
||||
if ( $.livequery.running && $.livequery.queue.length ) {
|
||||
var length = $.livequery.queue.length;
|
||||
// Run each Live Query currently in the queue
|
||||
while ( length-- )
|
||||
$.livequery.queries[ $.livequery.queue.shift() ].run();
|
||||
}
|
||||
},
|
||||
|
||||
pause: function() {
|
||||
// Don't run anymore Live Queries until restarted
|
||||
$.livequery.running = false;
|
||||
},
|
||||
|
||||
play: function() {
|
||||
// Restart Live Queries
|
||||
$.livequery.running = true;
|
||||
// Request a run of the Live Queries
|
||||
$.livequery.run();
|
||||
},
|
||||
|
||||
registerPlugin: function() {
|
||||
$.each( arguments, function(i,n) {
|
||||
// Short-circuit if the method doesn't exist
|
||||
if (!$.fn[n]) return;
|
||||
|
||||
// Save a reference to the original method
|
||||
var old = $.fn[n];
|
||||
|
||||
// Create a new method
|
||||
$.fn[n] = function() {
|
||||
// Call the original method
|
||||
var r = old.apply(this, arguments);
|
||||
|
||||
// Request a run of the Live Queries
|
||||
$.livequery.run();
|
||||
|
||||
// Return the original methods result
|
||||
return r;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
run: function(id) {
|
||||
if (id != undefined) {
|
||||
// Put the particular Live Query in the queue if it doesn't already exist
|
||||
if ( $.inArray(id, $.livequery.queue) < 0 )
|
||||
$.livequery.queue.push( id );
|
||||
}
|
||||
else
|
||||
// Put each Live Query in the queue if it doesn't already exist
|
||||
$.each( $.livequery.queries, function(id) {
|
||||
if ( $.inArray(id, $.livequery.queue) < 0 )
|
||||
$.livequery.queue.push( id );
|
||||
});
|
||||
|
||||
// Clear timeout if it already exists
|
||||
if ($.livequery.timeout) clearTimeout($.livequery.timeout);
|
||||
// Create a timeout to check the queue and actually run the Live Queries
|
||||
$.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
|
||||
},
|
||||
|
||||
stop: function(id) {
|
||||
if (id != undefined)
|
||||
// Stop are particular Live Query
|
||||
$.livequery.queries[ id ].stop();
|
||||
else
|
||||
// Stop all Live Queries
|
||||
$.each( $.livequery.queries, function(id) {
|
||||
$.livequery.queries[ id ].stop();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register core DOM manipulation methods
|
||||
$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');
|
||||
|
||||
// Run Live Queries when the Document is ready
|
||||
$(function() { $.livequery.play(); });
|
||||
|
||||
|
||||
// Save a reference to the original init method
|
||||
var init = $.prototype.init;
|
||||
|
||||
// Create a new init method that exposes two new properties: selector and context
|
||||
$.prototype.init = function(a,c) {
|
||||
// Call the original init and save the result
|
||||
var r = init.apply(this, arguments);
|
||||
|
||||
// Copy over properties if they exist already
|
||||
if (a && a.selector)
|
||||
r.context = a.context, r.selector = a.selector;
|
||||
|
||||
// Set properties
|
||||
if ( typeof a == 'string' )
|
||||
r.context = c || document, r.selector = a;
|
||||
|
||||
// Return the result
|
||||
return r;
|
||||
};
|
||||
|
||||
// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
|
||||
$.prototype.init.prototype = $.prototype;
|
||||
|
||||
})(jQuery);
|
||||
typenow = 'wpsc-product';
|
||||
@ -1,342 +0,0 @@
|
||||
/*
|
||||
* jQuery Tooltip plugin 1.1
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
|
||||
*
|
||||
* Copyright (c) 2006 Jörn Zaefferer, Stefan Petre
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.tooltip.js 2237 2007-07-04 19:11:15Z joern.zaefferer $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Display a customized tooltip instead of the default one
|
||||
* for every selected element. The tooltip behaviour mimics
|
||||
* the default one, but lets you style the tooltip and
|
||||
* specify the delay before displaying it. In addition, it displays the
|
||||
* href value, if it is available.
|
||||
*
|
||||
* Requires dimensions plugin.
|
||||
*
|
||||
* When used on a page with select elements, include the bgiframe plugin. It is used if present.
|
||||
*
|
||||
* To style the tooltip, use these selectors in your stylesheet:
|
||||
*
|
||||
* #tooltip - The tooltip container
|
||||
*
|
||||
* #tooltip h3 - The tooltip title
|
||||
*
|
||||
* #tooltip div.body - The tooltip body, shown when using showBody
|
||||
*
|
||||
* #tooltip div.url - The tooltip url, shown when using showURL
|
||||
*
|
||||
*
|
||||
* @example $('a, input, img').Tooltip();
|
||||
* @desc Shows tooltips for anchors, inputs and images, if they have a title
|
||||
*
|
||||
* @example $('label').Tooltip({
|
||||
* delay: 0,
|
||||
* track: true,
|
||||
* event: "click"
|
||||
* });
|
||||
* @desc Shows tooltips for labels with no delay, tracking mousemovement, displaying the tooltip when the label is clicked.
|
||||
*
|
||||
* @example // modify global settings
|
||||
* $.extend($.fn.Tooltip.defaults, {
|
||||
* track: true,
|
||||
* delay: 0,
|
||||
* showURL: false,
|
||||
* showBody: " - ",
|
||||
* fixPNG: true
|
||||
* });
|
||||
* // setup fancy tooltips
|
||||
* $('a.pretty').Tooltip({
|
||||
* extraClass: "fancy"
|
||||
* });
|
||||
$('img.pretty').Tooltip({
|
||||
* extraClass: "fancy-img",
|
||||
* });
|
||||
* @desc This example starts with modifying the global settings, applying them to all following Tooltips; Afterwards, Tooltips for anchors with class pretty are created with an extra class for the Tooltip: "fancy" for anchors, "fancy-img" for images
|
||||
*
|
||||
* @param Object settings (optional) Customize your Tooltips
|
||||
* @option Number delay The number of milliseconds before a tooltip is display. Default: 250
|
||||
* @option Boolean track If true, let the tooltip track the mousemovement. Default: false
|
||||
* @option Boolean showURL If true, shows the href or src attribute within p.url. Defaul: true
|
||||
* @option String showBody If specified, uses the String to split the title, displaying the first part in the h3 tag, all following in the p.body tag, separated with <br/>s. Default: null
|
||||
* @option String extraClass If specified, adds the class to the tooltip helper. Default: null
|
||||
* @option Boolean fixPNG If true, fixes transparent PNGs in IE. Default: false
|
||||
* @option Function bodyHandler If specified its called to format the tooltip-body, hiding the title-part. Default: none
|
||||
* @option Number top The top-offset for the tooltip position. Default: 15
|
||||
* @option Number left The left-offset for the tooltip position. Default: 15
|
||||
*
|
||||
* @name Tooltip
|
||||
* @type jQuery
|
||||
* @cat Plugins/Tooltip
|
||||
* @author Jörn Zaefferer (http://bassistance.de)
|
||||
*/
|
||||
|
||||
/**
|
||||
* A global flag to disable all tooltips.
|
||||
*
|
||||
* @example $("button.openModal").click(function() {
|
||||
* $.Tooltip.blocked = true;
|
||||
* // do some other stuff, eg. showing a modal dialog
|
||||
* $.Tooltip.blocked = false;
|
||||
* });
|
||||
*
|
||||
* @property
|
||||
* @name $.Tooltip.blocked
|
||||
* @type Boolean
|
||||
* @cat Plugins/Tooltip
|
||||
*/
|
||||
|
||||
/**
|
||||
* Global defaults for tooltips. Apply to all calls to the Tooltip plugin after modifying the defaults.
|
||||
*
|
||||
* @example $.extend($.Tooltip.defaults, {
|
||||
* track: true,
|
||||
* delay: 0
|
||||
* });
|
||||
*
|
||||
* @property
|
||||
* @name $.Tooltip.defaults
|
||||
* @type Map
|
||||
* @cat Plugins/Tooltip
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
// the tooltip element
|
||||
var helper = {},
|
||||
// the current tooltipped element
|
||||
current,
|
||||
// the title of the current element, used for restoring
|
||||
title,
|
||||
// timeout id for delayed tooltips
|
||||
tID,
|
||||
// IE 5.5 or 6
|
||||
IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
|
||||
// flag for mouse tracking
|
||||
track = false;
|
||||
|
||||
$.Tooltip = {
|
||||
blocked: false,
|
||||
defaults: {
|
||||
delay: 200,
|
||||
showURL: true,
|
||||
extraClass: "",
|
||||
top: 15,
|
||||
left: 15
|
||||
},
|
||||
block: function() {
|
||||
$.Tooltip.blocked = !$.Tooltip.blocked;
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
Tooltip: function(settings) {
|
||||
settings = $.extend({}, $.Tooltip.defaults, settings);
|
||||
createHelper();
|
||||
return this.each(function() {
|
||||
this.tSettings = settings;
|
||||
// copy tooltip into its own expando and remove the title
|
||||
this.tooltipText = this.title;
|
||||
$(this).removeAttr("title");
|
||||
// also remove alt attribute to prevent default tooltip in IE
|
||||
this.alt = "";
|
||||
})
|
||||
.hover(save, hide)
|
||||
.click(hide);
|
||||
},
|
||||
fixPNG: IE ? function() {
|
||||
return this.each(function () {
|
||||
var image = $(this).css('backgroundImage');
|
||||
if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
|
||||
image = RegExp.$1;
|
||||
$(this).css({
|
||||
'backgroundImage': 'none',
|
||||
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
|
||||
}).each(function () {
|
||||
var position = $(this).css('position');
|
||||
if (position != 'absolute' && position != 'relative')
|
||||
$(this).css('position', 'relative');
|
||||
});
|
||||
}
|
||||
});
|
||||
} : function() { return this; },
|
||||
unfixPNG: IE ? function() {
|
||||
return this.each(function () {
|
||||
$(this).css({'filter': '', backgroundImage: ''});
|
||||
});
|
||||
} : function() { return this; },
|
||||
hideWhenEmpty: function() {
|
||||
return this.each(function() {
|
||||
$(this)[ $(this).html() ? "show" : "hide" ]();
|
||||
});
|
||||
},
|
||||
url: function() {
|
||||
return this.attr('href') || this.attr('src');
|
||||
}
|
||||
});
|
||||
|
||||
function createHelper() {
|
||||
// there can be only one tooltip helper
|
||||
if( helper.parent )
|
||||
return;
|
||||
// create the helper, h3 for title, div for url
|
||||
helper.parent = $('<div id="tooltip"><h3></h3><div class="body"></div><div class="url"></div></div>')
|
||||
// hide it at first
|
||||
.hide()
|
||||
// add to document
|
||||
.appendTo('body');
|
||||
|
||||
// apply bgiframe if available
|
||||
if ( $.fn.bgiframe )
|
||||
helper.parent.bgiframe();
|
||||
|
||||
// save references to title and url elements
|
||||
helper.title = $('h3', helper.parent);
|
||||
helper.body = $('div.body', helper.parent);
|
||||
helper.url = $('div.url', helper.parent);
|
||||
}
|
||||
|
||||
// main event handler to start showing tooltips
|
||||
function handle(event) {
|
||||
// show helper, either with timeout or on instant
|
||||
if( this.tSettings.delay )
|
||||
tID = setTimeout(show, this.tSettings.delay);
|
||||
else
|
||||
show();
|
||||
|
||||
// if selected, update the helper position when the mouse moves
|
||||
track = !!this.tSettings.track;
|
||||
$('body').bind('mousemove', update);
|
||||
|
||||
// update at least once
|
||||
update(event);
|
||||
}
|
||||
|
||||
// save elements title before the tooltip is displayed
|
||||
function save() {
|
||||
// if this is the current source, or it has no title (occurs with click event), stop
|
||||
if ( $.Tooltip.blocked || this == current || !this.tooltipText )
|
||||
return;
|
||||
|
||||
// save current
|
||||
current = this;
|
||||
title = this.tooltipText;
|
||||
|
||||
if ( this.tSettings.bodyHandler ) {
|
||||
helper.title.hide();
|
||||
helper.body.html( this.tSettings.bodyHandler.call(this) ).show();
|
||||
} else if ( this.tSettings.showBody ) {
|
||||
var parts = title.split(this.tSettings.showBody);
|
||||
helper.title.html(parts.shift()).show();
|
||||
helper.body.empty();
|
||||
for(var i = 0, part; part = parts[i]; i++) {
|
||||
if(i > 0)
|
||||
helper.body.append("<br/>");
|
||||
helper.body.append(part);
|
||||
}
|
||||
helper.body.hideWhenEmpty();
|
||||
} else {
|
||||
helper.title.html(title).show();
|
||||
helper.body.hide();
|
||||
}
|
||||
|
||||
// if element has href or src, add and show it, otherwise hide it
|
||||
if( this.tSettings.showURL && $(this).url() )
|
||||
helper.url.html( $(this).url().replace('http://', '') ).show();
|
||||
else
|
||||
helper.url.hide();
|
||||
|
||||
// add an optional class for this tip
|
||||
helper.parent.addClass(this.tSettings.extraClass);
|
||||
|
||||
// fix PNG background for IE
|
||||
if (this.tSettings.fixPNG )
|
||||
helper.parent.fixPNG();
|
||||
|
||||
handle.apply(this, arguments);
|
||||
}
|
||||
|
||||
// delete timeout and show helper
|
||||
function show() {
|
||||
tID = null;
|
||||
helper.parent.show();
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
* callback for mousemove
|
||||
* updates the helper position
|
||||
* removes itself when no current element
|
||||
*/
|
||||
function update(event) {
|
||||
if($.Tooltip.blocked)
|
||||
return;
|
||||
|
||||
// stop updating when tracking is disabled and the tooltip is visible
|
||||
if ( !track && helper.parent.is(":visible")) {
|
||||
$('body').unbind('mousemove', update)
|
||||
}
|
||||
|
||||
// if no current element is available, remove this listener
|
||||
if( current == null ) {
|
||||
$('body').unbind('mousemove', update);
|
||||
return;
|
||||
}
|
||||
var left = helper.parent[0].offsetLeft;
|
||||
var top = helper.parent[0].offsetTop;
|
||||
if(event) {
|
||||
// position the helper 15 pixel to bottom right, starting from mouse position
|
||||
left = event.pageX + current.tSettings.left;
|
||||
top = event.pageY + current.tSettings.top;
|
||||
helper.parent.css({
|
||||
left: left + 'px',
|
||||
top: top + 'px'
|
||||
});
|
||||
}
|
||||
var v = viewport(),
|
||||
h = helper.parent[0];
|
||||
// check horizontal position
|
||||
if(v.x + v.cx < h.offsetLeft + h.offsetWidth) {
|
||||
left -= h.offsetWidth + 20 + current.tSettings.left;
|
||||
helper.parent.css({left: left + 'px'});
|
||||
}
|
||||
// check vertical position
|
||||
if(v.y + v.cy < h.offsetTop + h.offsetHeight) {
|
||||
top -= h.offsetHeight + 20 + current.tSettings.top;
|
||||
helper.parent.css({top: top + 'px'});
|
||||
}
|
||||
}
|
||||
|
||||
function viewport() {
|
||||
return {
|
||||
x: $(window).scrollLeft(),
|
||||
y: $(window).scrollTop(),
|
||||
cx: $(window).width(),
|
||||
cy: $(window).height()
|
||||
};
|
||||
}
|
||||
|
||||
// hide helper and restore added classes and the title
|
||||
function hide(event) {
|
||||
if($.Tooltip.blocked)
|
||||
return;
|
||||
// clear timeout if possible
|
||||
if(tID)
|
||||
clearTimeout(tID);
|
||||
// no more current element
|
||||
current = null;
|
||||
|
||||
helper.parent.hide().removeClass( this.tSettings.extraClass );
|
||||
|
||||
if( this.tSettings.fixPNG )
|
||||
helper.parent.unfixPNG();
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
@ -1,125 +0,0 @@
|
||||
//this contains a nearly exact copy of the wordpress product tag editing functions
|
||||
|
||||
function new_tag_remove_tag() {
|
||||
var id = jQuery( this ).attr( 'id' );
|
||||
var num = id.substr( 10 );
|
||||
var current_tags = jQuery( '#tags-input' ).val().split(',');
|
||||
delete current_tags[num];
|
||||
var new_tags = [];
|
||||
jQuery.each( current_tags, function( key, val ) {
|
||||
if ( val && !val.match(/^\s+$/) && '' != val ) {
|
||||
new_tags = new_tags.concat( val );
|
||||
}
|
||||
});
|
||||
jQuery( '#tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) );
|
||||
tag_update_quickclicks();
|
||||
jQuery('#newtag').focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
function tag_update_quickclicks() {
|
||||
if ( jQuery( '#tags-input' ).length == 0 )
|
||||
return;
|
||||
var current_tags = jQuery( '#tags-input' ).val().split(',');
|
||||
jQuery( '#tagchecklist' ).empty();
|
||||
shown = false;
|
||||
// jQuery.merge( current_tags, current_tags ); // this doesn't work anymore, need something to array_unique
|
||||
jQuery.each( current_tags, function( key, val ) {
|
||||
val = val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim
|
||||
if ( !val.match(/^\s+$/) && '' != val ) {
|
||||
txt = '<span><a id="tag-check-' + key + '" class="ntdelbutton">X</a> ' + val + '</span> ';
|
||||
jQuery( '#tagchecklist' ).append( txt );
|
||||
jQuery( '#tag-check-' + key ).click( new_tag_remove_tag );
|
||||
shown = true;
|
||||
}
|
||||
});
|
||||
if ( shown )
|
||||
jQuery( '#tagchecklist' ).prepend( '<strong>Tags Used</strong><br />' );
|
||||
}
|
||||
|
||||
function tag_flush_to_text(e,a) {
|
||||
a = a || false;
|
||||
var text = a ? jQuery(a).text() : jQuery('#newtag').val();
|
||||
var newtags = jQuery('#tags-input').val();
|
||||
|
||||
var t = text.replace( /\s*([^,]+).*/, '$1,' );
|
||||
newtags += ','
|
||||
|
||||
if ( newtags.indexOf(t) != -1 )
|
||||
return false;
|
||||
|
||||
newtags += text;
|
||||
|
||||
// massage
|
||||
newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' );
|
||||
jQuery('#tags-input').val( newtags );
|
||||
tag_update_quickclicks();
|
||||
if ( ! a ) {
|
||||
jQuery('#newtag').val('');
|
||||
jQuery('#newtag').focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function tag_save_on_publish() {
|
||||
if ( jQuery('#newtag').val() != postL10n.addTag )
|
||||
tag_flush_to_text();
|
||||
}
|
||||
|
||||
function tag_press_key( e ) {
|
||||
if ( 13 == e.keyCode ) {
|
||||
tag_flush_to_text();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
(function($){
|
||||
tagCloud = {
|
||||
init : function() {
|
||||
$('#tagcloud-link').click(function(){tagCloud.get(); $(this).unbind().click(function(){return false;}); return false;});
|
||||
},
|
||||
|
||||
get : function() {
|
||||
$.post('admin-ajax.php', {'action':'get-tagcloud'}, function(r, stat) {
|
||||
if ( 0 == r || 'success' != stat )
|
||||
r = wpAjax.broken;
|
||||
|
||||
r = '<p id="the-tagcloud">'+r+'</p>';
|
||||
$('#tagcloud-link').after($(r));
|
||||
$('#the-tagcloud a').click(function(){
|
||||
tag_flush_to_text(0,this);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
|
||||
jQuery(document).ready( function($) {
|
||||
tagCloud.init();
|
||||
tag_update_quickclicks();
|
||||
jQuery('#tags-input').livequery(function(){
|
||||
jQuery(this).hide();
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
// add the quickadd form
|
||||
jQuery('#jaxtag').livequery(function(){
|
||||
jQuery(this).prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="Add tag" /><input type="button" class="button" id="tagadd" value="Add" tabindex="3" /><input type="hidden"/><input type="hidden"/></span>');
|
||||
jQuery('#tagadd').click( tag_flush_to_text );
|
||||
jQuery('#newtag').focus(function() {
|
||||
// if ( this.value == postL10n.addTag )
|
||||
jQuery(this).val( '' ).removeClass( 'form-input-tip' );
|
||||
});
|
||||
tag_update_quickclicks();
|
||||
jQuery('#newtag').blur(function() {
|
||||
if ( this.value == '' )
|
||||
jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -1,92 +0,0 @@
|
||||
/*
|
||||
* this is the variations javascript file
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
|
||||
.variation_checkboxes
|
||||
|
||||
.variation_box
|
||||
.variation_checkbox
|
||||
.variation_checkbox input
|
||||
|
||||
.variation_values_box
|
||||
.variation_checkbox
|
||||
.variation_checkbox input
|
||||
|
||||
*/
|
||||
//Delete checkout options on settings>checkout page
|
||||
|
||||
|
||||
jQuery('.variation_checkboxes').livequery(function(){
|
||||
|
||||
jQuery('label input:checkbox', this).click(function(){
|
||||
|
||||
jQuery('a.update_variations_action').show();
|
||||
});
|
||||
|
||||
jQuery("div.variation_set>label input:checkbox", this).click(function(event){
|
||||
is_checked = jQuery(this).attr('checked');
|
||||
|
||||
variation_set = jQuery(this).parents("div.variation_set");
|
||||
|
||||
switch(is_checked) {
|
||||
case true:
|
||||
jQuery('div.variation input:checkbox', variation_set).attr('checked', true);
|
||||
jQuery('div.variation', variation_set).show();
|
||||
break;
|
||||
|
||||
case false:
|
||||
jQuery('div.variation input:checkbox', variation_set).attr('checked', false);
|
||||
jQuery('div.variation', variation_set).hide();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
//jQuery('input:checkbox' ,variation_set);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
jQuery("div.variation input:checkbox", this).click(function(event){
|
||||
is_checked = jQuery(this).attr('checked');
|
||||
variation_set = jQuery(this).parents("div.variation_set");
|
||||
variation = jQuery(this).parents("div.variation");
|
||||
switch(is_checked) {
|
||||
case true:
|
||||
jQuery('label.set_label input:checkbox', variation_set).attr('checked', true);
|
||||
jQuery('div.variation', variation_set).show();
|
||||
break;
|
||||
|
||||
case false:
|
||||
checked_count = jQuery('div.variation input:checked', variation_set).length;
|
||||
if(checked_count < 1) {
|
||||
jQuery('div.variation', variation_set).hide();
|
||||
jQuery('label.set_label input:checkbox', variation_set).attr('checked', false);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
jQuery("div.variation_set>label input:checkbox", this).livequery(function(event){
|
||||
});
|
||||
|
||||
jQuery("div.variation input:checkbox", this).livequery(function(event){
|
||||
is_checked = jQuery(this).attr('checked');
|
||||
variation_set = jQuery(this).parents("div.variation_set");
|
||||
checked_count = jQuery('div.variation input:checked', variation_set).length;
|
||||
if(checked_count < 1) {
|
||||
jQuery('div.variation', variation_set).hide();
|
||||
jQuery('label.set_label input:checkbox', variation_set).attr('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -1,362 +0,0 @@
|
||||
/**
|
||||
* This is a nearly exact copy of the corresponding wordpress file, we needed to copy and modify it for our use of swfupoader as the wordpress handler code is specific to posts
|
||||
*/
|
||||
// define a global variable for swfupload here so that we can later do things to it.
|
||||
var swfu = null;
|
||||
|
||||
|
||||
jQuery().ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
|
||||
// nonces are only regenerated on autosaving when ther product ID is created/changed
|
||||
// we only want to edit the swfuploader parameters when that happens
|
||||
if(/autosave-generate-nonces/.test(ajaxOptions.data)) {
|
||||
window.swfu.removePostParam('product_id');
|
||||
window.swfu.addPostParam('product_id', parseInt(jQuery('#post_ID').val()));
|
||||
}
|
||||
//console.log(jQuery('#post_ID').val());
|
||||
});
|
||||
|
||||
|
||||
function wpsc_fileDialogStart() {
|
||||
jQuery("#media-upload-error").empty();
|
||||
}
|
||||
|
||||
// progress and success handlers for media multi uploads
|
||||
function wpsc_fileQueued(fileObj) {
|
||||
// Create a progress bar containing the filename
|
||||
jQuery('#media-items').append('<div id="media-item-' + fileObj.id + '" ><div class="progress"><div class="bar"></div></div></div>');
|
||||
// Display the progress div
|
||||
jQuery('#media-item-' + fileObj.id + ' .progress').show();
|
||||
|
||||
// Disable the submit button
|
||||
//jQuery('#insert-gallery').attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
function wpsc_uploadStart(fileObj) {return true; }
|
||||
|
||||
function wpsc_uploadProgress(fileObj, bytesDone, bytesTotal) {
|
||||
// Lengthen the progress bar
|
||||
jQuery('#media-item-' + fileObj.id + ' .bar').width(500*bytesDone/bytesTotal);
|
||||
|
||||
if ( bytesDone == bytesTotal ) {
|
||||
jQuery('#media-item-' + fileObj.id + ' .bar').html('<strong class="crunching"></strong>');
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_prepareMediaItem(fileObj, serverData) {
|
||||
// Move the progress bar to 100%
|
||||
jQuery('#media-item-' + fileObj.id + ' .bar').remove();
|
||||
jQuery('#media-item-' + fileObj.id + ' .progress').hide();
|
||||
|
||||
var f = ( typeof shortform == 'undefined' ) ? 1 : 2;
|
||||
// Old style: Append the HTML returned by the server -- thumbnail and form inputs
|
||||
if ( isNaN(serverData) || !serverData ) {
|
||||
jQuery('#media-item-' + fileObj.id).append(serverData);
|
||||
prepareMediaItemInit(fileObj);
|
||||
}
|
||||
// New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
|
||||
else {
|
||||
jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_prepareMediaItemInit(fileObj) {
|
||||
|
||||
// Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
|
||||
jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id);
|
||||
|
||||
// Replace the original filename with the new (unique) one assigned during upload
|
||||
jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
|
||||
|
||||
// Also bind toggle to the links
|
||||
jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){var o=jQuery(this).offset();window.scrollTo(0,o.top-36);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
|
||||
|
||||
// Bind AJAX to the new Delete button
|
||||
jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){
|
||||
// Tell the server to delete it. TODO: handle exceptions
|
||||
jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{
|
||||
id : this.id.replace(/[^0-9]/g,''),
|
||||
action : 'delete-post',
|
||||
_ajax_nonce : this.href.replace(/^.*wpnonce=/,'')}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// Open this item if it says to start open (e.g. to display an error)
|
||||
jQuery('#media-item-' + fileObj.id + '.startopen')
|
||||
.removeClass('startopen')
|
||||
.slideToggle(500)
|
||||
.parent().eq(0).children('.toggle').toggle();
|
||||
}
|
||||
|
||||
function wpsc_itemAjaxError(id, html) {
|
||||
var error = jQuery('#media-item-error' + id);
|
||||
|
||||
error.html('<div class="file-error"><button type="button" id="dismiss-'+id+'" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+html+'</div>');
|
||||
jQuery('#dismiss-'+id).click(function(){jQuery(this).parents('.file-error').slideUp(200, function(){jQuery(this).empty();})});
|
||||
}
|
||||
|
||||
function wpsc_deleteSuccess(data, textStatus) {
|
||||
if ( data == '-1' )
|
||||
return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
|
||||
if ( data == '0' )
|
||||
return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
|
||||
|
||||
var item = jQuery('#media-item-' + this.id);
|
||||
|
||||
// Decrement the counters.
|
||||
if ( type = jQuery('#type-of-' + this.id).val() )
|
||||
jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1);
|
||||
if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
|
||||
jQuery('.toggle').toggle();
|
||||
jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
|
||||
}
|
||||
|
||||
// Vanish it.
|
||||
jQuery('#media-item-' + this.id + ' .filename:empty').remove();
|
||||
jQuery('#media-item-' + this.id + ' .filename').append(' <span class="file-error">'+swfuploadL10n.deleted+'</span>').siblings('a.toggle').remove();
|
||||
jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end()
|
||||
.animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50})
|
||||
.animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()})
|
||||
.animate({backgroundColor:'#fff'}, 400)
|
||||
.animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function wpsc_deleteError(X, textStatus, errorThrown) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
function wpsc_updateMediaForm() {
|
||||
storeState();
|
||||
// Just one file, no need for collapsible part
|
||||
if ( jQuery('.type-form #media-items>*').length == 1 ) {
|
||||
jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle();
|
||||
jQuery('.type-form .slidetoggle').siblings().addClass('hidden');
|
||||
}
|
||||
|
||||
// Only show Save buttons when there is at least one file.
|
||||
if ( jQuery('#media-items>*').not('.media-blank').length > 0 )
|
||||
jQuery('.savebutton').show();
|
||||
else
|
||||
jQuery('.savebutton').hide();
|
||||
|
||||
// Only show Gallery button when there are at least two files.
|
||||
if ( jQuery('#media-items>*').length > 1 )
|
||||
jQuery('.insert-gallery').show();
|
||||
else
|
||||
jQuery('.insert-gallery').hide();
|
||||
}
|
||||
|
||||
function wpsc_uploadSuccess(fileObj, serverData) {
|
||||
// if async-upload returned an error message, place it in the media item div and return
|
||||
if ( serverData.match('media-upload-error') ) {
|
||||
jQuery('#media-item-' + fileObj.id).html(serverData);
|
||||
return;
|
||||
}
|
||||
//console.log(fileObj);
|
||||
//console.log(serverData);
|
||||
eval(serverData);
|
||||
if(upload_status == 1 ) {
|
||||
output_html = "";
|
||||
output_html +="<li class='gallery_image' id='product_image_"+image_id+"'>\n";
|
||||
output_html += " <input type='hidden' value='"+image_id+"' name='gallery_image_id[]' class='image-id'/>\n";
|
||||
output_html += " <div id='gallery_image_"+image_id+"' class='previewimage'>\n";
|
||||
output_html += " <a class='thickbox' rel='product_extra_image_"+image_id+"' href='admin.php?wpsc_admin_action=crop_image&imagename="+image_src+"&imgheight=480&imgwidth=600&product_id=103&width=640&height=342' id='extra_preview_link_"+image_id+"'>\n";
|
||||
output_html += " <img title='Preview' alt='Preview' src='"+image_src+"' class='previewimage'/>\n";
|
||||
output_html += " </a>\n";
|
||||
output_html += " <img src='" + WPSC_CORE_IMAGES_URL + "/cross.png' class='deleteButton' alt='-' style='display: none;'/>\n";
|
||||
output_html += " </div>\n";
|
||||
output_html += "</li>\n";
|
||||
|
||||
image_count = jQuery("ul#gallery_list li.gallery_image div a img.previewimage").size();
|
||||
if(image_count < 1) {
|
||||
replace_existing = 1;
|
||||
}
|
||||
//console.log(jQuery("ul#gallery_list li.gallery_image div a img.previewimage"));
|
||||
//console.log(image_count);
|
||||
|
||||
if(replace_existing == 1) {
|
||||
jQuery("ul#gallery_list").html(output_html);
|
||||
|
||||
input_set = jQuery.makeArray(jQuery("#gallery_list li:not(.ui-sortable-helper) input.image-id"));
|
||||
set = new Array();
|
||||
for( var i in input_set) {
|
||||
set[i] = jQuery(input_set[i]).val();
|
||||
}
|
||||
//console.log(set);
|
||||
|
||||
img_id = jQuery('#gallery_image_'+set[0]).parent('li').attr('id');
|
||||
|
||||
jQuery('#gallery_image_'+set[0]).children('img.deleteButton').remove();
|
||||
jQuery('#gallery_image_'+set[0]).append("<a class='editButton'>Edit <img src='" + WPSC_CORE_IMAGES_URL + "/pencil.png' alt ='' /></a>");
|
||||
// jQuery('#gallery_image_'+set[0]).parent('li').attr('id', 0);
|
||||
|
||||
for(i=1;i<set.length;i++) {
|
||||
jQuery('#gallery_image_'+set[i]).children('a.editButton').remove();
|
||||
jQuery('#gallery_image_'+set[i]).append("<img alt='-' class='deleteButton' src='" + WPSC_CORE_IMAGES_URL + "/cross.png'/>");
|
||||
|
||||
element_id = jQuery('#gallery_image_'+set[i]).parent('li').attr('id');
|
||||
if(element_id == 0) {
|
||||
// jQuery('#gallery_image_'+set[i]).parent('li').attr('id', img_id);
|
||||
}
|
||||
}
|
||||
|
||||
order = set.join(',');
|
||||
product_id = jQuery('#product_id').val();
|
||||
|
||||
|
||||
postVars = "product_id="+product_id+"&order="+order;
|
||||
jQuery.post( 'index.php?wpsc_admin_action=rearrange_images', postVars, function(returned_data) {
|
||||
eval(returned_data);
|
||||
jQuery('#gallery_image_'+image_id).children('a.editButton').remove();
|
||||
jQuery('#gallery_image_'+image_id).children('div.image_settings_box').remove();
|
||||
jQuery('#gallery_image_'+image_id).append(image_menu);
|
||||
});
|
||||
} else {
|
||||
jQuery("ul#gallery_list").append(output_html);
|
||||
///jQuery("#gallery_list").trigger( 'update' );
|
||||
}
|
||||
}
|
||||
|
||||
//jQuery('#media-item-' + fileObj.id + ' .progress').show();
|
||||
//window.setInterval(function() {
|
||||
jQuery("#media-item-" + fileObj.id + "").fadeOut("normal");
|
||||
//}, 5000);
|
||||
|
||||
//prepareMediaItem(fileObj, serverData);
|
||||
//updateMediaForm();
|
||||
|
||||
}
|
||||
|
||||
function wpsc_uploadComplete(fileObj) {
|
||||
// If no more uploads queued, enable the submit button
|
||||
if ( swfu.getStats().files_queued == 0 )
|
||||
jQuery('#insert-gallery').attr('disabled', '');
|
||||
}
|
||||
|
||||
|
||||
// wp-specific error handlers
|
||||
|
||||
// generic message
|
||||
function wpsc_wpQueueError(message) {
|
||||
jQuery('#media-upload-error').show().text(message);
|
||||
}
|
||||
|
||||
// file-specific message
|
||||
function wpsc_wpFileError(fileObj, message) {
|
||||
jQuery('#media-item-' + fileObj.id + ' .filename').after('<div class="file-error"><button type="button" id="dismiss-' + fileObj.id + '" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+message+'</div>').siblings('.toggle').remove();
|
||||
jQuery('#dismiss-' + fileObj.id).click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
|
||||
}
|
||||
|
||||
function wpsc_fileQueueError(fileObj, error_code, message) {
|
||||
// Handle this error separately because we don't want to create a FileProgress element for it.
|
||||
if ( error_code == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED ) {
|
||||
wpQueueError(swfuploadL10n.queue_limit_exceeded);
|
||||
}
|
||||
else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) {
|
||||
fileQueued(fileObj);
|
||||
wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit);
|
||||
}
|
||||
else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) {
|
||||
fileQueued(fileObj);
|
||||
wpFileError(fileObj, swfuploadL10n.zero_byte_file);
|
||||
}
|
||||
else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) {
|
||||
fileQueued(fileObj);
|
||||
wpFileError(fileObj, swfuploadL10n.invalid_filetype);
|
||||
}
|
||||
else {
|
||||
wpQueueError(swfuploadL10n.default_error);
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_fileDialogComplete(num_files_queued) {
|
||||
try {
|
||||
if (num_files_queued > 0) {
|
||||
this.startUpload();
|
||||
}
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function wpsc_swfuploadPreLoad() {
|
||||
var swfupload_element = jQuery('#'+swfu.customSettings.swfupload_element_id).get(0);
|
||||
jQuery('#' + swfu.customSettings.degraded_element_id).hide();
|
||||
// Doing this directly because jQuery().show() seems to have timing problems
|
||||
if ( swfupload_element && ! swfupload_element.style.display )
|
||||
swfupload_element.style.display = 'block';
|
||||
}
|
||||
|
||||
function wpsc_swfuploadLoadFailed() {
|
||||
jQuery('#' + swfu.customSettings.swfupload_element_id).hide();
|
||||
jQuery('#' + swfu.customSettings.degraded_element_id).show();
|
||||
}
|
||||
|
||||
function wpsc_uploadError(fileObj, error_code, message) {
|
||||
// first the file specific error
|
||||
if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) {
|
||||
wpFileError(fileObj, swfuploadL10n.missing_upload_url);
|
||||
}
|
||||
else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) {
|
||||
wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded);
|
||||
}
|
||||
else {
|
||||
wpFileError(fileObj, swfuploadL10n.default_error);
|
||||
}
|
||||
|
||||
// now the general upload status
|
||||
if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) {
|
||||
wpQueueError(swfuploadL10n.http_error);
|
||||
}
|
||||
else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) {
|
||||
wpQueueError(swfuploadL10n.upload_failed);
|
||||
}
|
||||
else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) {
|
||||
wpQueueError(swfuploadL10n.io_error);
|
||||
}
|
||||
else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) {
|
||||
wpQueueError(swfuploadL10n.security_error);
|
||||
}
|
||||
else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) {
|
||||
wpQueueError(swfuploadL10n.security_error);
|
||||
}
|
||||
}
|
||||
|
||||
// remember the last used image size, alignment and url
|
||||
var storeState;
|
||||
(function($){
|
||||
|
||||
storeState = function(){
|
||||
var align = getUserSetting('align') || '', imgsize = getUserSetting('imgsize') || '';
|
||||
|
||||
$('tr.align input[type="radio"]').click(function(){
|
||||
setUserSetting('align', $(this).val());
|
||||
}).filter(function(){
|
||||
if ( $(this).val() == align )
|
||||
return true;
|
||||
return false;
|
||||
}).attr('checked','checked');
|
||||
|
||||
$('tr.image-size input[type="radio"]').click(function(){
|
||||
setUserSetting('imgsize', $(this).val());
|
||||
}).filter(function(){
|
||||
if ( $(this).attr('disabled') || $(this).val() != imgsize )
|
||||
return false;
|
||||
return true;
|
||||
}).attr('checked','checked');
|
||||
|
||||
$('tr.url button').click(function(){
|
||||
var c = this.className || '';
|
||||
c = c.replace(/.*?(url[^ '"]+).*/, '$1');
|
||||
if (c) setUserSetting('urlbutton', c);
|
||||
$(this).siblings('.urlfield').val( $(this).attr('title') );
|
||||
});
|
||||
|
||||
$('tr.url .urlfield').each(function(){
|
||||
var b = getUserSetting('urlbutton');
|
||||
$(this).val( $(this).siblings('button.'+b).attr('title') );
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
|
Before Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 183 B |
|
Before Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 607 B |
|
Before Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 345 B |
|
Before Width: | Height: | Size: 339 B |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 979 B |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 119 B |
|
Before Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 365 B |
|
Before Width: | Height: | Size: 754 B |
|
Before Width: | Height: | Size: 701 B |
|
Before Width: | Height: | Size: 75 B |
|
Before Width: | Height: | Size: 733 B |
|
Before Width: | Height: | Size: 803 B |
|
Before Width: | Height: | Size: 674 B |
|
Before Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 673 B |
|
Before Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 166 B |
|
Before Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 137 B |
|
Before Width: | Height: | Size: 786 B |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 65 B |
|
Before Width: | Height: | Size: 69 B |
|
Before Width: | Height: | Size: 67 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 914 B |
|
Before Width: | Height: | Size: 1.6 KiB |