Up to [Local Repository] / interchange / lib / Vend
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
* Make TAX_CATEGORY_FIELD work as intended, where a colon-separated table and field will work as well as a simple field in the same table as the item.
Remove unnecessary calls to item_subtotal and thus the database. In the first chunk, when there's a discount, there were extra calls to item_subtotal. In the second chunk, apply_discount only takes one argument, and it calls item_subtotal itself, so there's no point in calling it in the parent. Patch by Josh Braegger <jbraegger@backcountry.com>, with a little cleanup and removal of the now-unused $tmp variable by myself. Thanks, Josh!
Vend::Interpolate::interpolate_html returns undef on undefined input text. This allows to determine whether $Tag->include fails or just produces an empty string.
Under rare cases the missing search can fall through in a block below, which
caused an internal server error in the following code line:
$obj->{matches} = scalar @{$obj->{mv_results}};
This is now mitigated by an empty mv_results array and results in a search
error as one would expect.
* Make levies description fix I should have originally made.
* Make levies description fix I should have originally made.
* Make levies description fix I should have originally made.
* Fix bug in my commit found by Racke
* Fix bug in my commit found by Racke
* Fix bug in my commit found by Racke.
* Fix deficiency in Levies, where multiple handling modes separated by null would not work as in the old subtotal calculation model.
* Fix deficiency in Levies, where multiple handling modes separated by null would not work as in the old subtotal calculation model.
* Fix deficiency in Levies, where multiple handling modes separated by null would not work as in the old subtotal calculation model.
Change syntax for option to use custom SQL as a counter.
Resolves syntax conflict with MySQL pseudo-counters:
db_name:table_name(column_name)
Syntax is now:
dbname:SELECT function_name(args)
Optimize empty [perl] blocks. Skip costly eval of code entirely if perl tag was called with no code, as is often done for the side-effect of opening database handles.
* Fix bug: Remove /o causing change of delimiter for all loops on page.
Fixed bug where previous rows values were left in $Row if [loop] is iterated with [PREFIX-next].
Fix regexes that use UTF-8 inside a Safe compartment. Patch by Sonny Cook <sonny@endpoint.com>, with some logging tweaks by me.
Various minor UTF-8 changes.
Correct attribution of &Vend::CharSet::display_chars (which is from
perluniintro manpage).
Enable localization of an error string.
Match content type more tightly in 2 spots ("text" is only trustworthy
in the MIME major type, not minor, and even that may be a stretch).
Simplify request method matching in a few places for readability and a
(trivial) performance benefit.
Use conventional $c lexical instead of $g for catalog hashref.
Fix tab/space differences to match context.
Update copyrights of files changed in 2008.
Add new synonym [if var ...] = [if variable ...] to match the [var] tag. The invalid [if var ...] form was quietly accepted but always evaluated to true, so this synonym is an important usability enhancement for any expected [if var ...] that would evaluate to true during testing but misleadingly appears to work. Includes a unit test, and also tests for [if variable ...] and [if global ...]. Thanks to Dan Collis-Puro <dan@endpoint.com> for the idea.
* Give the "flypage" SpecialSub the choice of returning a plain SKU
value rather than the overly-complicated { mv_results => [[$sku]] }
hashref.
* Get rid of cuddled else that is not within coding guidelines (perlstyle).
* Incorporate changes suggested by Lars Tode: - Make sort apply even if type is custom and nothing is returned by custom routine - Allow inclusive attribute even for non-salestax items.
* Allow localisation of the "No search was found" error message.
Patch supplied by Rene Hertell - thanks.
Add option to use a custom SQL function as a counter.
This allows something other than a plain database sequence to be used to
replace counter files, for example to allow character prefixes or suffixes
with sequences, or to avoid writing files locally when in a cluster
environment.
For example, if you create a function called "custom_counter" in PostgreSQL,
you would set up catalog.cfg like this:
UserDB default sql_counter "userdb:custom_counter('userdb_username_seq')"
Route default sql_counter "transactions:custom_counter('order_number_seq')"
And whatever the custom_counter function returns will be used by Interchange.
Correct output of value-extended after successful file write. The docs here: http://www.icdevgroup.org/interchange-doc-5.2.0/frames/ictags_121.html state, and it makes intuitive sense, that Perly true should be returned when a file is successfully written. This was not the case before. Also use earlier-set lexicals to avoid repeating the fallback to ''. Thanks to Spencer Christensen <schristensen@backcountry.com> for the patch.
* Further to the previous patch. It seemed a bit silly to keep the
random=0 backward compatibility when all of the other rules were
thrown out of the window, so random=0 is now the same as random=no
(return all of the original rows in their original order).
* Fix to the "random" parameter used by looping tags.
-- If set to "no" or "false" then do nothing (previously returned
one random result).
-- If set to "yes" or "true" then then return all results in a
random order (again, previously returned one random result).
-- If set to a numeric > 0 then return that many random results.
-- If set to 0 then return 1 random result (as before).
-- If set to a numeric > the available results then return all
results in a random order (previously returned the original
results in the original order).
If you're using "random=yes" to request one random result then you
will need to change your code to use random=1 instead.
* Upon reconsideration, I have made negative tax amounts excluded upon use of a pragma. It seems to me that if you want to prevent negative tax, you should prevent negative amounts.
* Fix salestax() routine to not allow negative tax. Allow it with use of a Pragma, if someone wants to implement refunds. * Remove code that does nothing -- fly_tax was being run frequently when not needed at all. (The $cost var was never accessed again.)
* Fixed something that looked like a security bug. It seemed to me
that a filename of "tmp/../../../../something" would get past the
checks, so changed the code to make use of Vend::File::allowed_file()
instead.
* Created a new [PREFIX-include] loop sub-tag. This works just like
the [include] tag, except that it allows other [PREFIX-*] sub-tags
to be parsed from within the included file.
Note: Files included with [PREFIX-include] cannot contain further
[PREFIX-include] sub-tags. This could be easily created (respecting
the "include_depth" Limit etc.) but I felt that that was an
unnecessary overhead.
* Added a new "scratchd" test type. This is the same as "scratch"
except that it deletes the variable from the scratchpad after
testing.
pass to labeled_list fixing behaviour of fly-list to be matching other x-list tags (#89)
Superfluous Vend::Interpolate::sort_cart function removed (#70).
* Add templated more-list feature. Completely compatible with default,
but allows a list like:
{FIRST_LINK?}{FIRST_LINK} {/FIRST_LINK?}
{PREV_LINK?}{PREV_LINK} {/PREV_LINK?}
{DECADE_PREV?}{DECADE_PREV} {/DECADE_PREV?}
{MORE_LIST}
{DECADE_NEXT?} {DECADE_NEXT}{/DECADE_NEXT?}
{NEXT_LINK?} {NEXT_LINK}{/NEXT_LINK?}
{LAST_LINK?} {LAST_LINK}{/LAST_LINK?});
Supports following:
{MATCH_COUNT} Same as [match-count], number of matches
{MATCHES} Same as [matches]
{LAST_PAGE} Last page number
{CURRENT_PAGE} Current page number
{DECADE_FIRST} First page of decade
{DECADE_LAST} Last page of decade
{FIRST_MATCH} First match displayed on this page
{LAST_MATCH} Last match displayed on this page
{FIRST_LINK} Link to first page
{PREV_LINK} Link to previous page
{DECADE_PREV} Link to decade previous
{MORE_LIST} The page list
{DECADE_NEXT} Link to next decade
{NEXT_LINK} Link to next page
{LAST_LINK} Link to last page
* Add ability for custom more routine with $opt->{more_routine} name
passed in [search-region] or [query].
* Example for a simple match display:
[search-region]
[search-list]
[item-param sku] - [item-param description]<br>
[/search-list]
[more-list /icons/right.gif /icons/left.gif 0 0]
<p>
{PREV_LINK}
Page {CURRENT_PAGE} of {TOTAL_PAGES}
{NEXT_LINK}
</p>
[/more-list]
[/search-region]
We may want to add an additional subtemplate for the different match
types, but we will wait to see how this works.
Developed with generous support of Paradigm CC -- thanks Peter!
Adding support for negative indexes on PREFIX-pos constructs.
New Free Software Foundation Address in headers of various files
New Free Software Foundation Address in headers of various files
issue error message if subroutine for PREFIX-exec is missing
Fix [on-match]/[no-match] for loop lists without matchlimit generated from embedded Perl objects
* The [sql-quote] sub-tag (in the [query] tag) didn't work properly
if the column data spanned multiple lines, as it may do with an
INSERT or UPDATE etc.
(back-ported from CVS HEAD)
* Added a new $Vend::LockedOut internal flag to test for locked out
users instead of testing for "http://127.0.0.1". This avoids a
side-effect that could be felt by people running Interchange on
their local workstation.
* Fix an issue, reported by Carl Bailey, where links containing
127.0.0.1 can get saved into [timed-build] cache files.
* Add [if config UserDB.captcha] per request by Jon.
* Allow lookups of multiple levels of config setting, i.e: [if config UserDB->captcha] [captcha function=imagetag] [/if]
* The [sql-quote] sub-tag (in the [query] tag) didn't work properly
if the column data spanned multiple lines, as it may do with an
INSERT or UPDATE etc.
frames code has been removed from Interchange a long time ago, so this is a no-op unless session is manipulated manually
* Add lockout to list of SpecialSub routines allowed.
* If user-configured lockout routine returns true, it replaces the
current routine completely. If it returns false, the normal one
is run as well.
* Move the logging out of Vend::Dispatch to the do_lockout routine, so
that you can avoid the log entry if your user-configured routine handles
the lockout.
* Make the number of seconds for robot reset adjustable from its
current hardcoded 30:
Limit lockout_reset_seconds
Maybe that should be robot_reset_seconds, I don't know.
* Change use of $Vend::Cfg->{Limit}{member} to $::Limit->{member}. As
Limit is used in iterative routines like chain_cost, this should
improve performance.
* s/ESLASH/SLASH/ as should have always been
Remove legacy [/page] and [/order] macros.
* Incompatible change, but unavoidable. Change variable setting determining country for tax basis. Problem was that MV_COUNTRY_FIELD was determining the country for the multistate order check. Since some installations were changing that to "tax_country" and manipulating that variable for taxing purposes, there was interactin. Change MV_COUNTRY_FIELD in Interpolate.pm to MV_COUNTRY_TAX_VAR. * TODO: make change in UPGRADE.
Add "env" base to conditionals, allowing [if env HTTPS], etc.
* Prevent crash when $::Discounts not defined.
* Prevent crash when $::Discounts not defined.
* Fix syntax error introduced by improper application of patch.
* Fix syntax error introduced with improper application of patch.
* Fix error logging problem with switch_discount_space().
* Patch error log problems with switch_discount_space().
merged changes 2.261 vs 2.261.2.1 +++ 2.261.2.1 +++ fixed typo
fixed typo
* Add mv_shipping_when_taxable member to "multi" taxing, so that you can tax shipping only when taxable items are in the total.
From Ethan Rowe <ethan@endpoint.com>: Fixed bug in &Vend::Interpolate::iterate_array_list that could cause the $Row object to be an empty hashref in the event of certain looping conditions that cause the field hash to be populated but not the fieldname array.
From Ethan Rowe <ethan@endpoint.com>: Fixed some issues in the discount-related code to ensure that the $::Discounts hashref is used appropriately and to maximize robustness of discount-spaces function.
added flypage SpecialSub according to the discussion on interchange-core in November 2003
* Fix bug where VAT was being calculated on item price before discount.
Remove duplicate settings of $opt->{login}, which is already forced earlier
in the function for $opt->{auto}.
Add new $Sub object that allows access to catalog subs and globalsubs from within [calc] and [perl] blocks. May need tweaking for Safe::Hole later, but that would make it more capable, not less, so I want to get this in for now.
* Add transfer-encoding parameter as suggested by Lars Tode.
Add new quoting mechanism for the [query] tag, from Kevin Walsh.
An example:
[query
list=1
sql=|
SELECT * FROM products WHERE sku = [sql-quote][cgi sku][/sql-quote]
|
]
...
It uses the query's database handle to access DBI's quote method.
workaround for shadow tables and dbh method
Correct debug message; this no longer uses &Vend::Interpolate::do_tag.
* Fix bug introduced in discount_space change -- mv_discount would not work in all instances (for individual product pricing). * Make item-difference work with mv_discount -- I don't believe it previously could or did, as it had no way to know of a discount.
- XHTML-compliance: - lowercased some HTML tags (all containers, so no ">" vs. "/>" issues)
* Allow levies to mark themselves as inclusive. * Don't pay attention to whitespace in the return of ITL exclude_if and include_if members.
* Change [quantity-name] and [modifier-name attribute] to [PREFIX-quantity-name] and [PREFIX-modifier-name attribute]. * Provide list compatibility routines to make the old tag keywords work. * Update standard catalog to use these. * Passes regression tests 100%. * I thought this had been done a long time ago!
* Make TaxInclusive work for Levies.
* Implement new AccumulateCode and TagRepository directives. The rationale
is:
-- There is a huge base of Interchange code, much of which is not
needed in even the standard catalog with full UI. This causes a
larger memory profile than necessary.
-- It is difficult to determine from the page code what code is
needed, especially when a [tag] can call a $Tag can call
a filter can call some sort of Action.
-- A feature is needed to allow building catalogs with a more
nearly optimal set of code than just "everything".
If AccumulateCode is no, operation is exactly as before. There have
been some code initialization changes and routine calling changes,
but the data structures are identical and no difference in operation
should be seen.
If you set AccumulateCode to "Yes" and specify a TagRepository that
contains all known UserTag, ActionMap, Filter, Widget, etc. etc.
code, Interchange starts accumulating and compiling these as
needed.
The code is sent to the master process for compilation and
incorporation, so that the next iteration of a page after HouseKeeping
seconds will find the code already compiled and ready to go.
It also copies the code file to the "code" (actually $Global::TagDir)
directory in the "Accumulated" subdirectory tree. When you restart
Interchange, these tags/filters/widgets/checks are read normally
and need not be recompiled on the fly.
Over time, as you access pages and routines, a full set of tags
will be developed and you can turn AccumulateCode to "No".
* There can be failures due to calling a $Tag from within embedded
Perl for the first time, particularly when it uses a MapRoutine or
calls another $Tag within. This is due to Safe, and there is probably
not much to be done about it. The good news is that the error should
go away after HouseKeeping seconds when the tag gets compiled by the
master.
This could be avoided in the case of an AllowGlobal catalog, and it
might be possible to make a directive that turns on AllowGlobal only
when in AccumulateCode mode.
The area, tmp, tmpn, and image tags are known to fail in this
way in the standard catalog. Tags that are frequently called
in this fashion should probably be placed in a "code/Vital"
directory and not be accumulated.
* This is only recommended for development -- it might
be possible to remove a tag/filter/etc. from the master
and recompile these on the fly, but I haven't looked at that
yet.
Another nice feature is that you can easily add a tag simply
by adding its code to the TagRepository and having it
compiled.
* WARNING: Nice features are often dangerous! Don't run this in
production -- you have been warned!
* WARNING: OrderCheck is not yet implemented, and a full audit has
not been done on all compiled code directives.
* WARNING: Not fully tested in Prefork mode, and really not intended for
that mode.
* WARNING: Including multiple tags in a file may have unpredictable
behavior. You should try to keep related Alias and tag things in
the same file.
* This feature only applies to Global code -- Catalog-based code
shows no change.
* Passes the regression tests 100% when called with an empty "code"
directory, compiling every tested tag and executing without error.
* Move improperly-positioned glob mapping.
* We had been running without warnings so long, we had gotten a bit sloppy
in our code in some places.
Because we do lots of uninitialized hash member stuff with arrays
of fields and $opt, it is basically unreasonable for us to run with
the "use of uninitialized variable" warnings. Because we do a fair
amount of numerical comparisons on empty string values, it seemed
unreasonable to run with "string value in numeric gt" enabled.
Also, because Safe, HTML::Entities, and some other modules have
these checks enabled, page code is bound to have warnings issued
no matter what you do.
It seems better to run with some warnings enabled so that we can
catch bad code practice.
So I have made the code run without warnings prior to and after
interpolate_html(), and turned off warnings by default in the
page code.
If it is desirable to turn on warnings for pages, you can use
[pragma perl_warnings_in_page] and see warnings for that page
(or by default if you put in catalog.cfg).
* In general these changes are:
no warnings qw(uninitialized numeric);
in most pages.
* Add $::Pragma->{perl_warnings_in_page}.
* Remove defined checks when simple set tests will do.
* Streamline some code.
* Various variable initializations and tests to avoid warnings.
* Turn off warnings in strategic places so that we don't get inundated with uninitialized variable warnings
* More unitialzed variable warnings dealt with.
Patch from Ethan Rowe <ethan@endpoint.com>:
Test 60 was failing due to an oversite on my part in
Vend::Interpolate::subtotal(). The pre-discount-space logic had a check:
my $discounts = defined $Vend::Session->{discount};
Later on, while looping through the products, it checks if $discounts is
true, and if so, adds the item's discounted subtotal to the running subtotal;
otherwise, it adds the item's full-price subtotal.
The discount spaces expect the $::Discounts hash to always exist. Therefore,
I changed the check to be based on:
my $discounts = (defined $::Discounts and %$::Discounts);
The discount_price sub forces the discount hash into exist when it encounters
an item with an mv_price attribute. However, the logic is now expecting the
discount hash to actually contain members, because it will always exist.
Therefore, the following patch to Interpolate.pm struck me as the right fix.
Let me know if you think there's a better way to do it. In any case, it
fixes the problem specific to test #60.
* Make the start of XHTML support for Interchange. * Add global XHTML and catalog XHTML options. Global is false/off by default, and catalog option is defaulted from global option. * The only effect is that Dispatch.pm sets $Vend::Xtrailer to the appropriate value of '/' or ''. * Use $Vend::Xtrailer to set any <br/> or <br> we use. * Change some generated HTML to: -- lowercase tags -- quote parms -- use $Vend::Xtrailer * Supply [br] tag which returns the proper <br/> or <br>.
Patch from Ethan Rowe <ethan@endpoint.com>, which I've been sitting on
for far too long. His comments:
Discount-space rework according to agreements reached between involved
core team members; modified initialization logic and configuration such
that discount spaces do not make an impact on page processing for catalogs
that do not explicitly make use of the feature. Changes include:
DiscountSpacesOn -- boolean catalog configuration directive. This is
FALSE by default. When set to true, a dispatch routine is added
to the (relatively new) dispatch routine stack, to be evaluated
per page process prior to autoloads; this routine initializes the
current discount space to 'main', and then checks all CGI variables
specified in the DiscountSpaceVar configuration array in the event
that an alternate discount space has been specified via CGI variables.
When DiscountSpacesOn is FALSE, *all* discount space functions become
a no-op; attempts to specify an alternate discount space will have no
effect, and will result in an error message in the catalog's error log.
DiscountSpaceVar -- array catalog configuration directive, with a default
entry of 'mv_discount_space'; the members of this array are treated as
names of CGI variables to check per page process, such that a CGI variable
can be used to specify the discount space to use for that page process
in a manner akin to values space ('mv_values_space') or named shopping
cart ('mv_cartname'). The CGI variables will *not* be checked unless
DiscountSpacesOn is true. While default behavior of 'mv_discount_space'
is likely to suffice for most purposes, people can tie the discount space
to other things, such as the cart, by including other variable names in
this array (for instance, 'mv_cartname' would tie the discount space to
the cart name, which could be convenient in some situations).
A new global object has been introduced: $::Discounts. This will always
point to the current discount hash; changing the discount space via
CGI variables or the [discount-space] tag will update $::Discounts.
Furthermore, a new Safe object has been introduced for accessing the
current discount space in [perl] and [calc] blocks: $Discounts.
Any code that works directly with the $Vend::Session->{discount} hash
should be updated to work with the $::Discounts variable (in global
space) and the $Discounts variable (in Safe space such as [perl] and
[calc]). Care has been taken to maintain backwards compatibility,
and working directly with the {discount} session member will generally
not cause problems (changing the discount space will in fact change the
hash to which $Vend::Session->{discount} points), except in the case of
reassigning the hash (i.e., $Session->{discount} = { 'SOMEITEM' => ' %s *
0.80 ' }); reassigning the hash will break the $::Discounts reference and
result in unpredictable behavior for the remainder of the page process.
Therefore, it is strongly advised that all such code be updated at some
point to use the new objects. Furthermore, any actions such as clearing
the discounts should be done by dereferencing rather than assigning a
new hashref.
Thus:
%$Discounts = ();
and not:
$Discounts = {};
Furthermore, you can clear the discount space via:
[discount-space name=some_spacename clear=1]
The current discount space name can be checked via:
[discount-space current=1]
Sessions: to maintain backwards compatibility, sessions continue to use a
{discount} member. However, at session initialization, all sessions will
receive a {discount_space}{main} member, and {discount} will point to it.
The session read process is essentially unchanged, with the exception of
a minor assignment in which $::Discounts is initialized to point to the
{discount} member. The modification to discount-spaces was driven in
part to reduce the number of assignments necessary at session read time,
and this new implementation is a reflection of that.
For the future, it may be worthwhile to revise the logic to eliminate
the {discount} session member entirely, and simply expect all code to
work directly through the $::Discounts/$Discounts variables. This would
allow some slight adjustments to the implementation of the discount space
initialization and switching logic, making it slightly more efficient
and certainly cleaner.
Add new "if" type, "control", with tests. By Ethan Rowe <ethan@endpoint.com>.
Restore behavior of an empty [link-template][/link-template] block, which used to fall back to the default link template, but then started suppressing links altogether. This was inadvertently changed in revision 2.119 of Vend::Interpolate as part of a bug fix. The bug is now fixed in a different, compatible way.
lowercase HTML tags as suggested by jojo
* Add "permanent more" feature so that you can create pageable searches that are shared between people and are cacheable by search engines. * To activate, put in search URL/form: pm=1 or mv_more_permanent=1 * To activate in [query ...], use pm=1. * Changes hashing to two levels so that it will handle larger sets of searches. * Depends on consistent spacing of queries, caches query for mv_cache_key that determines location. The change of a single bit of whitespace will change the key! * When your data changes, a saved search could be wrong when referenced from a bookmark/saved link and no initializing search has been done. * WARNING: Could generate very large file sets, watch your inodes!
Patch from Ethan Rowe <ethan@endpoint.com>:
Update the DiscountSpaceVar configuration directive to allow for an
array of different CGI variable names. These are the names of CGI
variables that will be checked per page process in order to determine
the initial discount namespace; defaults to 'main' if the CGI variables
are empty/undefined. The discount space initialization logic based on
CGI variables will only be used for catalogs in which the DiscountSpaces
directive is set to true ("yes").
Tied the session {discount} member to the current discount
namespace subhash from {discount_space}{<spacename>} to maximize
compatibility of discount namespaces with existing code dependent
upon $Session->{discount}; switching the discount namespace will
always result in $::Discounts = $Vend::Session->{discount} =
$Vend::Session->{discount_space}{<SPACENAME>} ||= {};
Updated read_session to ensure that $::Discounts and
$Vend::Session->{discount} always refer to the default ('main') discount
namespace from $Vend::Session->{discount_space}{main} at the start of
page processing.
* Re-add [PREFIX-alternate] changes blown away by discount changes commit made without CVS update.
New Perl object $Row available in PREFIX-calc blocks for access to the
current loop row. Avoids quoting problems.
Contributed by Ethan Rowe <ethan@endpoint.com>. His description:
Introduces a new Perl object, defined only in the context of [PREFIX-calc]
loop subtags, providing a hashref to the current row. The application
programmer can use this new object, $Row, to directly retrieve values
from the different fields within the current row, rather than quoting
the interpolated values of [PREFIX-param], [PREFIX-code], etc.
Thus, instead of:
[sql-calc]
my $value = q{[sql-param some_column]} * 5;
return "The value times five is $value";
[/sql-calc]
The application programmer can instead use:
[sql-calc]
my $value = $Row->{some_column} * 5;
return "The value times five is $value";
[/sql-calc]
The $Row hashref will be undefined when accessed in standard [perl]
or [calc] blocks; it is only valid in the context of a loop ([loop],
[query], [item-list]). Note further that, when used in a search-type loop
(e.g. [loop search="..."]), return fields should be specified within the
search in order for the row hash to be populated correctly; otherwise,
only the sku/primary key will have a value in the $Row hash.
New discount-space functionality by Ethan Rowe <ethan@endpoint.com>.
His notes follow.
Implements discount namespaces, in a manner consistent with the
values-space functionality. The [discount-space] usertag can be used
to change the current discount namespace, causing all subsequent
discount-related tags and calculations to operate from that particular
namespace. Usage:
[discount-space name=<space>]
Changes the current discount namespace to <space>.
[discount-space current=1]
Returns the name of the current namespace.
[discount-space name=<space> clear=1]
Clears all discount information from the specified namespace.
The discount space is initialized, per page process, in a manner
similar to values-space; if a CGI value exists under the variable name
"mv_discount_space", the discount space will be initialized to that
value. Furthermore, a catalog-level variable MV_DISCOUNT_SPACE can be
used to specify the name of an additional CGI variable to check in this
manner. When MV_DISCOUNT_SPACE is defined, it has higher precedence than
mv_discount_space for determining the initial namespace.
The discount-space logic is designed to integrate well with the cart. The
default discount spacename is "main". Setting the catalog variable
MV_DISCOUNT_SPACE to 'mv_cartname' allows the current discount namespace
to match the current cart when the current cart is set via CGI variables.
The discount namespaces are stored in the session at
$Vend::Session->{discount_space}{<spacename>}. Note that, for backwards
compatibility, the default space is always at $Vend::Session->{discount},
and that this will always serve as the master for he "main"
namespace such that $Vend::Session->{discount_space}{main}
= $Vend::Session->{discount}. Reassigning the hashref
for $Vend::Session->{discount_space}{<spacename>}
or $Vend::Session->{discount} can take Interchange internal
variables out of sync, and is thus discouraged (just as performing
a $Session->{scratch} = {} mid-page could cause odd behavior. Use
[discount-space name=<space> clear=1] instead, or assign to the
dereferenced hash (%{$Vend::Session->{discount}} = ()).
For further support, a discount_space parameter has been added to each
of the following tags; these tags all can be affected by discounts,
either in the calculation of a discount, a taxable sum, or an item
price (passing a discount namespace to these tags via the discount_space
parameter will only affect the current discount space within the context
of the tag itself):
[discount]
[fly-tax] (Also added named cart support to this tag in the process)
[item-list] (namespace specified will be used throughout the tag and its subtags)
[salestax]
[subtotal]
[total_cost]
EXAMPLES:
Set the current discount space to the default (which is 'main')
[discount-space]
OR
[discount-space main]
Set the current discount space to space "alt_discount"
[discount name=alt_discount]
Clear discount namespace "garbage"
[discount-space name=garbage clear=1]
Show the current discount namespace
[discount-space current=1]
Use the discount namespace "other" for this loop through the cart
[item-list discount_space=other]
...
[/item-list]
Add code to tax_vat function to enable proper tax calculations when TaxInclusive is set.
uc and lc filters are now working according to the current locale, e.g. umlauts will now properly modified
moved filter aliases to corresponding filter files, use similar syntax as usertag aliases
* Fix [query] causes [more] to generate non-unique mv_cache_key. The [more] tag generates a unique mv_cache_key for [list], [search-region], etc., but when used with [query],