The Official Website of AgoraCart and Agora.cgi
AgoraCart.com Demos Download AgoraCart User Manuals & Wiki Gold Members Forum Go Gold Now! Gold Version Memberships

AgoraCart.com

About
Features
Download
Payment Gateways
Send a Donation
Founders Club
BLOG: News & Updates

Showcases & Demos

AgoraCart Demos
Shop Live Stores

Downloads & Add-ons

Gold Version Downloads
DBwizz Database Mgr.
AgoraCart.com Store

Help & Support

User Manuals
Gold Version Users Forum
Gold Version Chat
Tech Support
Certified Agora Pros
Certified Designers
Hire a Freelancer

Gold Version Members

Member Benefits
Join Today!
Gold Members Home
Gold Version Users Forum
Gold Version Chat Rooms
Gold Version Downloads

For Store Owners

Merchant Accounts
Cool Resources
Advertise Here
"Powered by" Logos
Web Hosting Search

Misc.

Contact Us
MEET's Talking Guide
The Ancient Greek Agora






AgoraCart Free User Forums

This is the official FAQ and Cool Tips guide For the AgoraCart shopping Cart software


Official Sponsors of the AgoraCart Project:

       


RegisterSearchFAQLog in
Reply to topic Page 1 of 1
custom shipping error
Author Message
Reply with quote
Post custom shipping error 
while implementing my custom shipping thingy an error occurs in the sub date_to_epoch.
The errorlog tells me:
custom-shipping-logic Month '-1' out of range 0..11 at ./library/agora_order_lib.pl line 1115 etc.
Line 1115 refers to the line
return timelocal(59,59,23,$mredDate[1],$mredDate[0]-1,$mredDate[2]) in the sub date_to_epoch.

It looks like $mredDate[0] = zero or empty.... What could possibly cause that?


Thanks for you help in advance

Klaas

Reply with quote
Post  
What did you put in your custom shipping logic???


_________________
God Bless!
Bonnie - AgoraCart Moderator

Get a Gold Membership
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
Reply with quote
Post  
Hey Bonnie,
nothing special just something to check how it works. I wrote a subroutine to calculate the amount of pallets needed to ship the order and b4 implementing it was figuring out how all of the shipping scripts work.
I just found out the mistake in this logic:

@sc_shipping_logic = ( "Verzenden/Bezorgen||1-||2.00",
"Afhalen||1-||10.00");
$shipping_price = &calculate_shipping($temp_total,
$total_quantity, $total_measured_quantity);

its the backslash. Removed it and its fine. Wonder though how it did cause the month-value to go to -1????? Never mind.

Additional question: I remember reading something about how to put in a custom lib (for the calculate pallet subroutine.... Can you tell me where i can read about it...I dont recall.

And thanks putting me on the right track again...Smile

Reply with quote
Post  
The place to put your custom lib file, in v4.x, it's the 'custom' directory of the store; in v5, it's the 'add-ons' directory.
You can use codehooks to tie your custom lib into another subroutine to be used in the script.
Check out the codehook.txt file in the 'protected/DOCS' directory.

HTH!


_________________
God Bless!
Bonnie - AgoraCart Moderator

Get a Gold Membership
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
Reply with quote
Post custom shipping logic 
If i hardcode a shippingprice like $shipping_price = 100 in the $sc_custom_shipping_logic it returns nothing!

If i use a standard method like @sc_shipping_logic = (blabla) and $shipping_price = &calculate_shipping(etc.) its ok, but what i wanna do is determine shipping method like:
if ("$vform_Ecom_ShipTo_Method" eq "-some method-"){-do something-}

Basicly i need more examples NOT using @sc_shipping_logic, because i dont use subtotal nor quantity nor measured weight for calculating a shippingprice. I have to calculate a number of pallets needed for shipping. Have a subroutine ready to do that job but i cant test it because of what i mentioned above.

HELP! Cool

Best Regards Klaas

Reply with quote
Post  
Yep, you got the basic idea... go with it..
This might help, too:
http://www.agoracart.com/agorawiki/index.php?title=Custom_Shipping_Logic

HTH!


_________________
God Bless!
Bonnie - AgoraCart Moderator

Get a Gold Membership
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
Reply with quote
Post  
hey Bonnie thanks for the quick reply. I need it cuz this is the last thing to fix before going on air........ Very Happy

I came up with this custom shipping code:
Code:
$ship_method = $form_data{'Ecom_ShipTo_Method'};
 if ($ship_method eq "") {
   $use_vform = "yes";
   $ship_method = $vform{'Ecom_ShipTo_Method'};
 }
if ($ship_method eq "Verzenden"){
  $shipping_price = 150;
#line above must be eventualy be something like:
#$shipping_price = (&calculate_pallets *150);
#where calculate pallets is a custom sub returning the number
#of pallets needed.
}
else{
  $shipping_price = 0;
}
$shipping_logic_done = "yes";

but it still wont return a shipping price.
The method "Verzenden" is dutch for "Delivery" Smile

HTH to you too

Klaas

Reply with quote
Post hold on 
Got the code in my last post going..... i missed a bit of old un#ted code at the bottom of the custom shipping code.
(It allways something stupid like that) Mad

So i am trying my calculate pallets sub now...... keep your fingers crossed for me.

Klaas

Reply with quote
Post We are there! 
Dear Bonnie,

It works perfectly!!! Here is the code for calculating the number of pallets:
Code:

#######################################################################
sub calculate_pallets {
local (@transport,$quantity,$id,$pallets,$space1845,$space1345,$spacebig)=0;

open (CART, "$sc_cart_path")|| &file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
   while (<CART>)
   {
    @transport = split (/\|/, $_);
             $quantity = $transport[0];
        $id = $transport[1];
         if ($id eq "00034"){
           $pallets += $quantity;
           $space1845 += ($quantity *2);
            $space1345 += ($quantity *2);             
         }
         if ($id eq "00035"){
           $pallets += $quantity;
           $space1845 += $quantity;
            $space1345 += ($quantity *2);
         }
         if ($id eq "00036"){
           $space1845 -=$quantity;
            $space1345 -=$quantity;
            while ($space1845 <0){
             $pallets += 1;
               $space1845 += 4;
               $space1345 += 4;
               $spacebig +=1;
            }
         }   
         if ($id eq "00037"){
           $space1835 -=$quantity;
            $space1345 -=$quantity;
            while ($space1345 <0){
             $pallets += 1;
               $space1835 += 4;
               $space1345 += 4;
               $spacebig += 1;
            }
         }
   
   }
   close(CART);
   
return $pallets;
}   
1; #we are a library


Thanks for the support.

Klaas[/quote]

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum