Announcement

Collapse
No announcement yet.

Display shipping category value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Display shipping category value

    Is there any way to display the shipping category value for a given product?
    Dave

    #2
    Hve you tried this variable in your product layout?:
    <actinic:variable name="ShippingCategory" />

    Comment


      #3
      Yes,

      That returns the name of the category. Let me re-phrase my question

      Is there any way to display the shipping cost for any given product, on the product page? I am using categories to split between standard delivery, low rate delivery and free delivery items.
      Dave

      Comment


        #4
        You could use the weight of the product in blockifs to relay the costs, the more weights and more weight tiers you have the more complicated it would get, but certainly possible. Do the blockif tutorials on the forum if you want to learn about those.

        Pseudo code within each blockif:

        if weight == 0.25
        cost of shipping = £2.50
        endif

        if weight == 0.50
        cost of shipping = £3.50
        endif

        etc.

        Comment


          #5
          Revisited

          I gave up on this (as I was happy with current solution and others weren't) but unfortunately had to spend more time looking at it today. I wanted to share my attempts incase anyone else was looking for such functionality.

          This is no doubt very inelegant and can be improved upon if you actually have a decent working knowledge of how php and databases work.

          HTML Code:
           <actinic:block type="PriceList">
              <actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%201" >
                  <actinic:block php="true" SELECTABLE="false">
                      $taxrate = 0;
                      $exc = preg_replace('/[^0-9]/', '',
          '<actinic:variable name="TaxExclusivePrice" />');
                      $inc = preg_replace('/[^0-9]/', '',
          '<actinic:variable name="TaxInclusivePrice" />');
                      if ( ($exc != 0) && ($exc != $inc) )
                          {
                          $taxrate = ($inc - $exc) / $exc;
                          }
                      $taxrate = sprintf("%01.3f", $taxrate);
                      $taxrate = $taxrate + 1;
                  </actinic:block>
              </actinic:block>
          </actinic:block>
          The first section calculates the current tax rate. On our website I use it to recalculate component prices to show prices inclusive of VAT, but it also has functionality in the following block.
          HTML Code:
          <actinic:block php="true" >
          	$connect = odbc_pconnect("ActinicSimpleShipping<actinic:variable name="ECMajorVersion" selectable="false" />","","", SQL_CUR_USE_ODBC);
          	
          	$freeover_query = "SELECT dBandFreeOverThreshold FROM BandDefinition";
          	$freeover_results = odbc_exec($connect, $freeover_query);
          	$freeover_results = odbc_result($freeover_results, 1);
          	$freeover_results = sprintf ("£%01.0f", (($freeover_results * $taxrate)/100));
          	// Use statement below to call Free over value
          	// print $freeover_results;
          
          	$designator_query = "SELECT nID FROM Categories WHERE sDescription='<actinic:variable name="ShippingCategory" selectable="false" />'";
          	$designator_results = odbc_exec($connect, $designator_query);
          	$designator_results = odbc_result($designator_results, 1);
          	
          	if($designator_results==1){
          	$query = "SELECT dFixedCharge FROM ZoneCategoryCharges WHERE nCategoryID=1";
          	$result = odbc_exec($connect, $query);
          	$result = odbc_result($result, 1);
          	$result = sprintf ("£%01.2f", (($result * $taxrate)/100));
          	}
          elseif($designator_results==2){
          	$query = "SELECT dFixedCharge FROM ZoneCategoryCharges WHERE nCategoryID=2";
          	$result = odbc_exec($connect, $query);
          	$result = odbc_result($result, 1);
          	$result = sprintf ("£%01.2f", (($result * $taxrate)/100));
          	}
          elseif($designator_results==3){
          	$query = "SELECT dFixedCharge FROM ZoneCategoryCharges WHERE nCategoryID=3";
          	$result = odbc_exec($connect, $query);
          	$result = odbc_result($result, 1);
          	$result = sprintf ("£%01.2f", (($result * $taxrate)/100));
          	}
          elseif($designator_results==4){
          	$query = "SELECT dFixedCharge FROM ZoneCategoryCharges WHERE nCategoryID=4";
          	$result = odbc_exec($connect, $query);
          	$result = odbc_result($result, 1);
          	$result = sprintf ("£%01.2f", (($result * $taxrate)/100));
          	}
          else{
          print "DELIVERY CALCULATION TO BE DEFINED";
          }
          	// Use statement below to call delivery cost for this products category
          	// print $result;
          odbc_close_all();  
          </actinic:block>
          This block determines the Shipping Category of the product and then uses this to pull the shipping charge people will be expected to pay for that category. The benefit of this is that if you change the values, the pages will update. I have also included an orders free over value, if you have more than one zone with differing free over levels you will have to tweak this for each. I hope this is helpful to someone.
          Dave

          Comment

          Working...
          X