We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22574
    • 181 Posts
    Hey Guys,

    I have a client that now wants multiple shipping choices, which treasurechest and paypal cant seam to do.

    How I think it should work is once the ’view cart’ has been clicked, a new drop down would be under the items which the user can choose from say 8 options.

    I have tried modifying a few files including the std_cart_item.html file, but it wont update the view cart screen, If I go to that files URL it is updated tho?

    I also tried modifying std_cart_wrap.html which worked but I cant get the other php files to recognise my new drop down as a field that needs to be added to the total price.

    Has anyone done this, as I am sure its possible I am just not very good with php.

    Thanks
      • 22574
      • 181 Posts
      Okay after a lot of trail and error I worked out how to add extra shipping prices/locations.

      1. First I added a drop down list:
      <select name="postage" id="postage">
        <option value="3.50">VIC $3.50</option>
        <option  value="8.60">NSW $8.60</option>
      </select>
      


      to the std_cart_wrap.htm file in the chunks folder of TreasureChest, I put it just next to the update button and gave it a name of postage.

      2. In the treasurechest.class.php file in the TreasureChest folder I added some lines of code:
      at line 252 I added/changed this section to read:
      						$postage=$_REQUEST['postage'];
      						if ($item_id==postage)
      						{
      						$product['quantity'] = 1;
      						$product['item_name'] = 'Shipping $'.$postage;
      						}
      						if(!isset($postage))
      						{
      						$postage=3.50;
      						}
                              $product['shipping'] = $postage;


      Then at 315 I changed the line to be $cart_total = $cart_total + $postage;

      It now adds the drop down amount to the total and displays another box with a title and the amount.
      And the $product[’shipping’] = $postage; line over rights the original shipping price with the new drop down price, it also adds the first drop down amount to the total in case the customer forgets to select a shipping state or tries to not pay shipping.

      I have made some other changes but that’s the basic modification, its very ruff but it does the job!
        • 36582
        • 463 Posts
        Hi Pagalo,

        Sent you some PMs but your inbox is full...
          Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
          • 8425
          • 159 Posts
          Hello,
          I’m looking at a similar situation. I’ve updated the std_cart_wrap.html as follow:

          <body>
              <form action="[~[*id*]~]&action=update" method="post" id="treasure_chest_form" name="treasure_chest_form">
                  <table id="treasure_chest_cart">
                      <tbody>
                          [+cart.content+]
                          <tr height="5"><td></td></tr>
                          <tr>
                             <td colspan="4" align="right">
                                 Select your shipping destination: <select name="destination" id="destination">
                                    <option value="5">Canada</option>
                                    <option  value="10">U.S.A</option>
                                     <option  value="15">International</option>
                                 </select>
                             </td>
                          </tr>
                           <tr>
                             <td colspan="4" align="right">
                                 Ontario residents:                      
                                    <input type="radio" name="taxOntario" value="Yes" /> Yes 
                                    <input type="radio" name="taxOntario" value="No" /> No</td>
                             </td>
                          </tr>
                         <tr height="7"><td></td></tr>
                          <tr id="cart_button">
                              <td colspan="4">
                                  <button id="treasure_chest_update" type="submit">Update Cart</button>
                              </td>
                          </tr>
                          <tr id="cart_total">
                              <td colspan="4">
                                  <p class="cart_total_amount">Total: $[+cart.total+]</p>
                                  <span class="cart_total_amount">Additional tax and shipping charges may apply</span>
                              </td>
                          </tr>
                      </tbody>
                  </table>
              </form>   
              [+cart.payment+]
          </body>


          When I click on Checkout Paypal button I’d like to take my selection and pass along the taxes and shipping cost. What is the best way to do this. I looked at the treasureChest.class.php but I didn’t come up with a clean solution. Anything you could share is highly appreciated.
          Thank in advance

            • 4429
            • 429 Posts
            This seemed to work for me (I haven’t test fully yet) - but the cart total does not update, although the correct price does carry through to checkout. The other problem is that my view cart item shows 6 products even though there is only one product added plus shipping.

            http://www.gollygaloshes.com/proofing/gollygaloshes/index.php?id=11

            How would I modify the above code to have different size options, that cost different amounts and different colour option?

            Thanks
              • 8425
              • 159 Posts
              Same here. I can now get the price passed on to paypal but the shopping cart item number is not correct. TreasureChest development/support seems to be staled and by the amount of posts regarding TC I think nobody is really using this plugin in production... It is a shame because it had a good potential I think.
              I’m now looking at alternative like Magento...
              I’d appreciate if anyone would like to share his/her impression on Magento or other open source e-commerce solution.

              Thanks