Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] Interchange-4.5.5 -- PATCH Interpolate.pm and widget tag



******    message to minivend-users from Ton Verhagen <ton@verhagen.net>     ******

Hi All,

I made a little patch to tag_accessories in Interpolate.pm

One of my clients who sells build-to-order computers, wanted the price of 
the accessories (computer components) be displayed in the option list. The 
option list generated by the accessories tag should look like:
   <option value="product id"> product description -- ( add $1,450.00)

However the standard implementation of tag_accessories expects a comma 
separated option list. So, if you put a formatted price (which contains 
commas) into the list, it will break the string on the thousand separator 
of the price. :(

In order to fix this I,ve added a new option (delimiter) for the 
accessories tag. When set to e.g. delimiter="!" it will split the option 
list on "!". If not set/used it will split on the default (comma).

The same applies to the widget tag.

------------------------------------------------------------------------
--- Interpolate.pm-     Mon Aug 21 09:59:53 2000
+++ Interpolate.pm      Tue Aug 22 13:15:00 2000
@@ -1414,6 +1414,7 @@

         my $p = $opt->{prepend} || '';
         my $a = $opt->{append} || '';
+       my $delimiter = $opt->{delimiter} || ',';

         $type = 'select' unless $type;
         $field = $attribute unless $field;
@@ -1458,7 +1459,7 @@
         }

         my ($default, $label, $select, $value, $run);
-       my @opts = split /\s*,\s*/, $data;
+       my @opts = split /\s*$delimiter\s*/, $data;

         if($item) {
                 $default = $item->{$attribute};
------------------------------------------------------------------------


------------------------------------------------------------------------
--- widget-      Mon Aug 21 10:35:10 2000
+++ widget      Mon Aug 21 13:26:32 2000
@@ -19,6 +19,7 @@
                                 outboard        => $opt->{key} || undef,
                                 passed          => $opt->{data} || 
$opt->{passed} || $string,
                                 type            => $opt->{type} || 'select',
+                               delimiter       => $opt->{delimiter} || ',',
                                 };
         my $item = { $ref->{attribute} => $value };
         if($ref->{type} =~ /date/i) {
------------------------------------------------------------------------


Hope you find it useful.

Best regards,

Ton Verhagen

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: