Announcement

Collapse
No announcement yet.

PHP and Actinc Verables

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

    PHP and Actinc Verables


    OK I know I said PHP but I changed it to Javascript, I am now working on the PHP version.


    I am working on our own custom out of stock system, I know there a way of doing it in the advanced guild but I dont want to do it that way, what I like to do is add my own system using PHP or Javascript.

    I can get it to display the out of stock message oK but when it comes to adding the add to cart button I am having a few problems.

    Can any one give me any advice.

    I tried this in javascript:

    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">

    var stockl=<actinic:variable name="StockLevel" />;
    var outstock=0

    if (stockl == outstock) {
    document.write("Out of stock")
    }
    else {
    document.write ("<actinic:variable name="AddToCartButton" />");
    }

    </script>

    and almost simalert in PHP but not sure how to tell it to wright the add to cart button so that it works.

    I know a javascript pritty well a bit of a new commer to php but I am picking that up quick but not sure how to proced with the actinic veriables wright back.

    ta
    Darren
    Last edited by CCT.Darren; 19-Sep-2006, 10:10 AM. Reason: Javascript / PHP version underway!

    #2
    It ok I fix the problem my self using javascript.

    Comment


      #3
      Little PHP problem

      <!--PHP Version//-->
      <!--PHP Block Code//-->
      <actinic:block php="true">
      $currentstocklev='<actinic:variable name="StockLevel" />';
      $outofstocklev='0';
      $instocklev ='1';

      echo "$currentstocklev";
      echo "<br>";
      echo "$outofstocklev";
      echo "<br>";
      echo "$instocklev";

      if ($outofstocklev == $currentstocklev) {
      echo "Out of stock";
      } elseif ($instocklev == $currentstocklev) {
      echo '<actinic:variable name="AddToCartButton" />';
      } else {
      echo "PHP Error";
      }

      </actinic:block>

      Can any one sea what I am doing wrong in this

      TA

      Comment


        #4
        Lines like

        echo '<actinic:variable name="AddToCartButton" />';

        should be

        echo '<actinic:variable name="AddToCartButton" encoding="perl" selectable="false" />';

        Also why not look at Conditions - there's already one in the Design / Library / Conditions / Product / IsInStock

        containing

        (<actinic:variable name="IsStockMonitored" /> == FALSE) OR (<Actinic:Variable Name="StockLevel"/> >= <Actinic:Variable Name="StockSuspendLevel"/>)
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment

        Working...
        X