Announcement

Collapse
No announcement yet.

Displaying alternative and maximum weights

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

    Displaying alternative and maximum weights

    Hi

    Does anyone know if there's a way to display the alternative weight (volumetric) or maximum weight of a product to the customer? I can't find a variable for it.

    Thanks

    #2
    Pretty sure it is possible, i think the name of them is nothing like what you'd imagine and that confuses things. If you export a hierarchical file, you can see the field name, i always recall it being somewhat illogically named. 'shipping data' i think it might be.

    Comment


      #3
      <actinic:variable name="ShippingWeight" />

      Comment


        #4
        You can display the 'Weight in kg' field as Lee mentions above. If you however want to show the 'Alternate Weight' field then you will need to use PHP to extract the data from the database as I don't think there is an exposed variable for this.

        One way to do this is to place the following code into your Product Layout:
        (This assumes v10 but for v9 change ActinicCatalog10 to ActinicCatalog9)

        SNAPSHOT FIRST!

        Code:
        <actinic:block php="true" selectable="false" >
        
        		$prodid=("<actinic:variable name="ProductReference" encoding="perl" selectable="false" />");
        
        		$connect = odbc_connect("ActinicCatalog10","","");
        		
        		$query = "SELECT [sAltWeight] FROM [product] WHERE [Product Reference]='".$prodid."'";
        		$result = odbc_exec($connect, $query);
        		while(odbc_fetch_row($result)){ 
                    $answer = odbc_result($result, 1); 
        		}
        		odbc_close($connect);
        		
        		echo $answer;		
        
        </actinic:block>
        You can of course make this into a function and add it to actinic_main.php rather than have the full code in your layout.

        You can do this as follows:

        BACKUP actinic_main.php FIRST!!

        Add the following to the end of actinic_main.php just before: ?>
        (Note you will find actinic_main.php in C:\Program Files\Actinic v10 or C:\Program Files\Actinic v9)

        Code:
        	function GetAltWeight($prodid)
        	{
        		
        		global $answer;
        		
        		$connect = odbc_connect("ActinicCatalog10","","");
        		
        		$query = "SELECT [sAltWeight] FROM [product] WHERE [Product Reference]='".$prodid."'";
        		$result = odbc_exec($connect, $query);
        		while(odbc_fetch_row($result)){ 
                    $answer = odbc_result($result, 1); 
        		}
        		odbc_close($connect);
        		
        		return $answer;
        	}
        Then in your layout use this:

        Code:
        <actinic:block php="true">
        echo GetAltWeight("<actinic:variable name="ProductReference" encoding="perl" selectable="false" />");
        </actinic:block>
        Note you must restart Actinic after making changes to actinic_main.php

        (Thanks to Gabriel and Norman for the original code used here)

        Comment


          #5
          Many thanks for that Drounding! There's a lot to go at there, I'll give it a go and see how it works...

          Comment

          Working...
          X