[ic] Creating custom shipping dropdown list (about old post by Michael Lehmkuhl)

Paco Sánchez interchange-users@icdevgroup.org
Sun Jan 19 17:35:11 2003


Hi, I need to specify different shipping methods for different items that
are shipped by different vendors.

Searching through the list archives I found an old post by Michael Lehmkuhl
about the exact same thing and a solution that he tried but did't seem to
work 100%:

------------------ from old post ---------------------

Here is the code that we are calling to generate the shipping dropdown:
###### CODE ord/checkout.html ######
[item-list modular=1]

# Other stuff in here...

[seti currentvendor][item-field vendor][/seti]

<SELECT NAME=mv_shipmode onChange="this.form.submit()" CLASS="styled">
[seti vendormodes][data table=country key='[default country US]'
col=shipmodes][/seti]
[perl]

    my @temparr = split(/[\s,]/,$Scratch->{vendormodes});
    my $currentvendor = $Scratch->{currentvendor};

    # Display only those shipping modes that match the vendor for this
product.
    @temparr = grep { m"^$currentvendor" } @temparr;

    $Scratch->{vendormodes} = join(' ',@temparr);

# Also tried this...
#    $Values->{vendormodes} = join(' ',@temparr);

[/perl]

[shipping
    label=1
    mode='[scratchd vendormodes]'
]
[comment]
# Also tried this...
[shipping
    label=1
    mode='[value vendormodes]'
]
[/comment]
</SELECT>

# Other stuff in here...

[/item-list]
###### CODE ######

-------------------- end old post -------------------

Of course this is done after creating a field at the products database with
the name "vendor" and identifying shipping methods by the vendor prefix:
say we create vendor1 then an UPS shipping name for this vendor would be
vendor1UPS.

The problem is that it only works partially, and all shipping alternatives
show in the dropdown list, including those only reserved for other vendors.

In case Michael is still around here, or anyone who has used this, I would
appreciate some tips about making this work.

Thanks in advance!

Paco Sánchez
http://pacosanchez.com
mailto:psanchez%40pacosanchez%2ecom
ICQ 101879542