51 users online (1 members and 50 guests)  


  Results 1 to 2 of 2

Related

  1. shopping cart with joomla    Forum: General Discussion
    Replies: 2
  2. shopping cart needed    Forum: General Discussion
    Replies: 7
  3. How do i make a shopping cart?    Forum: Website Scripts Forum
    Replies: 5
  4. shopping cart    Forum: PHP Forum
    Replies: 0
  1. #1
    daye_chris's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2007
    Posts
    1

    PHP Shopping Cart Rules

    I am trying to make a simple php rule that will allow US customers to receive free shipping, Canada a total cost of $15, and all other $25. I don't really have any experience with PHP. I tried this,

    if $text_order_customer_country=US then $text_order_shipping_fee=$0; if $text_order_customer_country=CA then $text_order_shipping_fee=$15

    That didn't really work, If some one could show me an example on how it might be done I would greatly appreciate it.

    Thanks,
    Chris

  2. #2
    MdBenner's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2007
    Posts
    12

    Re: PHP Shopping Cart Rules

    Hi Chris,

    since you did not post any code I am not completely sure what you mean. However I think what you simply want to do is assign the shipping fee to the variable $text_order_shipping_fee dependent on the value of $text_order_customer_country.

    Since you have 3 different possibilities I would use a switch statement. This would look like this in php:

    Code:
    <?
    switch($text_order_customer_counrty){
     case "US":
      $text_order_shipping_free="$0";
     break;
    case "CA":
      $text_order_shipping_free="$15";
     break;
    default:
      $text_order_shipping_free="$25";
     break;
    }
    ?>
    Simon
    Last edited by vinyl-junkie; 12-08-2007 at 09:01 PM. Reason: Added code tags



Tags for this Thread