Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 01-18-2011 14:41:16

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

This Is Simple, But I'm Damned If I Know How To Implement It...

I have the following code in our  and simply need to make the box at the top not be present if there are no trade price or product option items in the display.  The problem is that the object that I need to base the check on () is further on in the code to where I want to display the top of the page box ...and, to further complicate things,  is part of a  loop...

has been tried (unsuccessfully), as has a look ahead assertion (also unsuccessfully), as has trying to include the box into the  statement (definitely was not a good idea), so can anyone offer any advice on what else I can try, please?

Code:

<?php 

$app       = $this->globals('khxc_display.app');
$ns        = $this->globals('khxc.namespace');
$ref       = $this->globals('khxc.ref');
$eol       = $this->globals('khxc.eol');

$prodlist  = $this->globals('ecom.prod_prodlist');

$navarray  = $this->globals('ecom.prod_navarray');
$imgwidth  = $this->globals('khxc_settings.' . $app . '.imgsizeprodsm');
$disablewl = $this->globals('khxc_settings.' . $app . '.disablewishlist');

$supsort   = $this->globals('ecom.prod_suppress_sort');
$showsort  = $this->globals('khxc_settings.' . $app . '.showsortopts');

$prodcount = count($prodlist);

$proddisp  = $this->globals('ecom.prod_proddetail');
$prodcat   = $proddisp['xcat'];

$catshow    = $this->globals('ecom.cat_catshow');
$catid      = $catshow['id'];

// require_once 'wurfl/TeraWurfl.php';
require_once realpath(dirname(__FILE__) . '/../../../../../litez/wurfl/TeraWurfl.php');
$wurflObj = new TeraWurfl();
$wurflObj -> getDeviceCapabilitiesFromAgent();

     if ($ns == 'prodshow') {

          print '<div style="text-align: center; color: black;">

          <div class="tm">
          <div class="b">

          <div class="l">
          <div class="r">

          <div class="bl">
          <div class="br">

          <div class="tl">
          <div class="tr">

          <div style="text-align: justify; font-size: smaller; color: black;">';

print '<br /><p>The main item on this page can only be selected together with the related items shown below on the 
<a href="http://litez.co.uk/' . $app . '-catshow/' . $prodcat . '.html" rel="external">main category page</a> for this item; however, the 
main item can be selected on its own, as can any of the related items, using the <strong>Add To Purchase</strong> button at the top of the listing for the 
main item, or the <strong>Add To Purchase List</strong> button at the bottom of the listing for the related items.</p><br />';

          print '</div>

          </div></div>
          </div></div>

          </div></div>
          </div></div>
          </div><br />';

     } elseif ($wurflObj->getDeviceCapability("is_wireless_device")) {

          print '<div style="text-align: center; color: black;">

          <div class="tm">
          <div class="b">

          <div class="l">
          <div class="r">

          <div class="bl">
          <div class="br">

          <div class="tl">
          <div class="tr">

          <div style="text-align: justify; font-size: smaller; color: black;">';

print '<br /><p><img src="/images/options_small.png" alt="Item Has Options" /> <strong>=</strong> Item has additional options, which it is not necessary to 
select in order to add it to your <strong>Prchase List</strong>, and which can viewed by clicking on the item image in order to view full details for that 
product.</p><br />';

          if (!(preg_match('/Litez_|PhotoFlora/',$catid))) {

print '<br /><p><img src="/images/trade_small.png" alt="Item Is Trade Price" /> <strong>=</strong> Trade price item.</p><br />';

          } // End of if statement.

          print '</div>

          </div></div>
          </div></div>

          </div></div>
          </div></div>
          </div><br />';

     } elseif (!(preg_match('/Litez_|PhotoFlora/',$catid))) {

          print '<div style="text-align: center; color: black;">

          <div class="tm">
          <div class="b">

          <div class="l">
          <div class="r">

          <div class="bl">
          <div class="br">

          <div class="tl">
          <div class="tr">

          <div style="text-align: center; font-size: smaller; color: black;">';

print '<br /><p><img src="/images/trade_small.png" alt="Item Is Trade Price" /> <strong>=</strong> Trade price item.</p><br />';

          print '</div>

          </div></div>
          </div></div>

          </div></div>
          </div></div>
          </div><br />';

     } // End of if statement.

if (empty($showsort)) {$supsort = 1;}

// +--
// | In this step we determine whether we will be showing
// | images in this display.
// +--

$multi_images = 0;

foreach ($prodlist as $num => $prod) {

     if ((!(empty($prod['imgsm']))) && ($prod['imgsm'] != 'none.png')) {$multi_images = 1;}

} // End of foreach statement.

// +--
// | Define the header text.
// +--

$header   = $this->globals('ecom.prod_store_header');

if (empty($header)) {

     if ($ns == 'prodshow') {$header = 'Related Items';} else {$header = 'Items';}

} else {

     $header .= ' Featured Items';

} // End of if statement.

$header   = $this->xhtml_encode($header);

$random  = 'x' . $this->random_key(8);

// +--
// | Print the form opener.
// +--

$nsid     = 'ns';
$formid   = $app . '--prodaddtocartM';

$this->xhtml_quickform_header($formid,$app,'addcart',array($nsid => $ns));

print '<table id="khxc--cptbl--' . $random . '" class="khxc_sorttable" rules="rows" frame="hsides" cellpadding="5px">' . $eol . $eol;

      // +--
      // | Print a table row opener.
      // +--

      print '<tr>' . $eol . $eol;

// +--
// | Loop through the products.
// +--

$counter = 0;

foreach ($prodlist as $num => $prod) {
      //Leave the below line at the top of the loop
      $counter++; //Increment the counter with each product
                  //The counter starts at 1 and counts up

     // +--
     // | Print the tds and their content.
     // +--

     $prodname    = $this->xhtml_encode($prod['name']);
     $prodid      = $this->xhtml_encode($prod['id']);
     $prodlink    = $this->link_namespace($app,'prodshow',$prod['id']);
     $proddesc    = $this->xhtml_encode($prod['descshort']);
     $imgname     = $prod['imgsm'];
     $prodoptions = $prod['xprodoptions'];
     $prodnum     = $prod['prodnum'];
     $title       = $prod['short_title'];
     $tagline     = $prod['ptag'];
     $shortdesc   = $prod['descshort'];
     $brand       = $prod['brand'];
     $model       = $prod['model'];
     $pricestatus = $prod['pricestatus'];
     $clearance   = $prod['clearance'];

     $catshow     = $this->globals('ecom.cat_catshow');
     $catid       = $catshow['id'];
     $catline     = $catshow['ctag'];

     $add_ok = 1;

     if (($prod['useinv']) && (!($prod['invlevel'] > 0))) {$add_ok = 0;}
     if ($prod['pricestatus'] == 'D') {$add_ok = 0;}

     $quandisp = 1;
     $quanform = $this->globals('khxc_cgi.' . $formid . '--' . $prodid . '--quantity');

     if (isset($quanform)) {$quandisp = $quanform;}

     $image_ok = 0;

     if ((!(empty($imgname))) && ($imgname != 'none.png')) {$image_ok = 1;}

     if ($image_ok) {

          $imgurl   = 'media/' . $app . '/prodsm/' . $imgname;

     if ((!empty($prodoptions)) && ($wurflObj->getDeviceCapability("is_wireless_device"))) {

$imgtag   = '<div style="z-index: 2; position: relative; top: 20px; left: 80px;" alt="Item Has Product Options" title="Item Has Product 
Options"><img src="/images/options_small.png" alt="Item Has Product Options" /><a href="' . $prodlink . '" title="' . $prodname . '"></div>';

          if ($clearance == '1') {

$imgtag   = '<div style="z-index: 2; position: relative; top: 40px; left: 80px;" alt="Item Is Trade Price &amp; Has Product Options" 
title="Item Is Trade Price &amp; Has Product Options"><img src="/images/trade_small.png" alt="Item Is Trade Price &amp; Has Product 
Options" /><a href="' . $prodlink . '" title="' . $prodname . '"></div><div style="z-index: 2; position: relative; top: 60px; left: 80px;" alt="Item Is 
Trade Price &amp; Has Product Options" title="Item Is Trade Price &amp; Has Product Options"><img src="/images/options_small.png" alt="Item Is Trade Price 
&amp; Has Product Options" /><a href="' . $prodlink . '" title="' . $prodname . '"></div>';

          } // End of if statement.

     } elseif ($clearance == '1') {

$imgtag   = '<div style="z-index: 2; position: relative; top: 20px; left: 80px;" alt="Trade Price" title="Trade Price"><img src="/images/trade_small.png" 
alt="Trade Price" /><a href="' . $prodlink . '" title="' . $prodname . '"></div>';

     } else {

$imgtag   = '<a href="' . $prodlink . '" title="' . $prodname . '">';

     } // End of if statement.

$imgtag  .= '<img src="' . $imgurl . '" ';

     if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}

$imgtag  .= 'alt="' . $prodname . '" /></a>';

print '<td style="vertical-align: middle; padding: 5px 0 0 0; width: 100px;">' . $imgtag;

print '<p style="text-align: left; width: 100px;"><a href="' . $prodlink . '" title="' . $prodname . '">';

print $title . '</a></p></td>' . $eol . $eol;

      } else {

          if ($multi_images) {

               print '<td>&nbsp;</td>' . $eol . $eol;

          } // End of if statement.n

      } // End of if statement.

     print '<td style="vertical-align: top; width: 30%;">';

     $this->globals('ecom.prod_proddisp',$prod);

if ($proddesc) {

     if ($prodnum == 'LDW_Cut_Wire_Cable_Flex') {

$addendum = '  <span style="color: red;">** Click on image for flex colour options and to enter cut length requirements **</span>';
$proddesc .= $addendum;

     } elseif ($brand == 'Litez') {

          if ($prodnum == 'Litez_Heavi_Bitz') {

$promotion = '  <span style="color: red;">** Own bottle supplied lamps now just &pound;12.50  - click the image for more details **</span>.';
$proddesc .= $promotion;
     
          } elseif ($pricestatus == 'V') {

$addition = '  <span style="color: red;">Click on the image for full details and complete item options</span>.';
$proddesc .= $addition;

          } elseif ($pricestatus == 'R') {

$promotion = '  <span style="color: red;">** Short duration special price **</span>.';
$proddesc .= $promotion;

          } // End of if statement.

     } // End of if statement.

} // End of if statement.

     print '<p style="text-align: justify; color: black; padding-right: 5px;">' . $proddesc . '</p><br/>';

     if (($add_ok) && ($brand == 'Litez')) {

          print '<div class="hidden">';

          $this->include_namespace($app,'prodshowoptlite',array('form' => $formid . '--' . $prodid, 'showquan' => 0, 'headfoot' => 0));

          print '</div>';

     } elseif (($add_ok) && ($prodnum == 'LDW_Cut_Wire_Cable_Flex')) {

          print '<div class="hidden">';

          $this->include_namespace($app,'prodshowoptlite',array('form' => $formid . '--' . $prodid, 'showquan' => 0, 'headfoot' => 0));

          print '</div>';

     } elseif ($add_ok) {

          if ($wurflObj->getDeviceCapability("is_wireless_device")) {

               print '<div class="hidden">';

               $this->include_namespace($app,'prodshowoptlite',array('form' => $formid . '--' . $prodid, 'showquan' => 0, 'headfoot' => 0));

               print '</div>';

          } else {

               $this->include_namespace($app,'prodshowoptlite',array('form' => $formid . '--' . $prodid, 'showquan' => 0, 'headfoot' => 0));

          } // End of if statement.

     } // End of if statement.
 
     $this->globals('ecom.prod_priceinfo',$prod['khxc.priceinfo']);

     $this->include_file($app,'pricedisp.php');

     if ((!empty($brand)) && (!empty($model))) {

          print '<p style="color: black; font-weight: bold;">' . $brand . ' - ' . $model . '</p>';

     } elseif (!empty($brand)) {

          print '<p style="color: black; font-weight: bold;">' . $brand . '</p>';

     } // End of if statement.

     print '<br />';

     if ($add_ok) {

          print '<label for="' . $formid . '--' . $prodid . '--quantity';
          print '" class="hidden">Quantity</label>' . $eol;
          print '<input class="khxc_formfield_box" type="checkbox" name="';
          print $formid . '--' . $prodid . '--quantity';
          print '" id="' . $formid . '--' . $prodid . '--quantity';
          print '" value="' . $quandisp . '" size="5" maxlength="5" /> <span style="font-style: normal; display: inline-block; color: black; 
          font-size: 0.7em; font-weight: bold;">Click Box To Select<br />...Then Add To Purchase List</span>' . $eol;

     } else {

          print '<label for="' . $formid . '--' . $prodid . '--quantity';
          print '" class="hidden">Quantity</label>' . $eol;
          print '<p class="hidden"><input type="hidden" name="';
          print $formid . '--' . $prodid . '--quantity';
          print '" id="' . $formid . '--' . $prodid . '--quantity';
          print '" value="' . $quandisp . '" /></p>' . $eol;

     } // End of if statement.

     print '</td>' . $eol . $eol;

     if ($counter == 2) {

     print '</tr>' . $eol . $eol;

     print '<tr>' . $eol . $eol;

     $counter = 0;

     } // End of if statement.

     } // End of foreach statement.

// +--
// | Print the table closure.
// +--

print '<td>&nbsp;</td></tr></table><p>&nbsp;</p>' . $eol . $eol;

// +--
// | Print the form closure.
// +--

$this->xhtml_quickform_footer($formid,'Add To Purchase List',1);

?>

Offline

 

#2 01-18-2011 15:03:01

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: This Is Simple, But I'm Damned If I Know How To Implement It...

Unless I'm not understanding what you're trying to test this bit of code near the top will set a variable to 1 if any of the products have a price or options.

Code:

$nopriceoption = 0;  // assume no price or option for now

foreach ($prodlist as $num => $prod) {
     if (!empty($prod['xprodoptions'])) {$nopriceoption = 1;}
}

Offline

 

#3 01-19-2011 14:20:38

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Re: This Is Simple, But I'm Damned If I Know How To Implement It...

That works beautifully, - thank-you.

I have also modified the code to remove a section that was not functioning properly, and now need to know how do I go about detecting the number of product options a product has?

I thought that something like

Code:

if ($prod['xprodoptions'] >= '2') {

should work, but it does not appear to.


Code:

<?php 

$app       = $this->globals('khxc_display.app');
$ns        = $this->globals('khxc.namespace');
$ref       = $this->globals('khxc.ref');
$eol       = $this->globals('khxc.eol');

$prodlist  = $this->globals('ecom.prod_prodlist');

$navarray  = $this->globals('ecom.prod_navarray');
$imgwidth  = $this->globals('khxc_settings.' . $app . '.imgsizeprodsm');
$disablewl = $this->globals('khxc_settings.' . $app . '.disablewishlist');

$supsort   = $this->globals('ecom.prod_suppress_sort');
$showsort  = $this->globals('khxc_settings.' . $app . '.showsortopts');

$prodcount = count($prodlist);

$proddisp  = $this->globals('ecom.prod_proddetail');
$prodcat   = $proddisp['xcat'];

$catshow    = $this->globals('ecom.cat_catshow');
$catid      = $catshow['id'];


// require_once 'wurfl/TeraWurfl.php';
require_once realpath(dirname(__FILE__) . '/../../../../../litez/wurfl/TeraWurfl.php');
$wurflObj = new TeraWurfl();
$wurflObj -> getDeviceCapabilitiesFromAgent();


$noproductoptions = 0;  // assume no product options for now
$notradeprice  = 0;  // assume no trade price to start with


foreach ($prodlist as $num => $prod) {

     if (!empty($prod['xprodoptions'])) {$noproductoptions = 1;}
     if (!empty($prod['clearance'])) {$notradeprice = 1;}

} // End of foreach statement.

     if ($ns == 'prodshow') {

          print '<div style="text-align: center; color: black;">

          <div class="tm">
          <div class="b">

          <div class="l">
          <div class="r">

          <div class="bl">
          <div class="br">

          <div class="tl">
          <div class="tr">

          <div style="text-align: justify; font-size: smaller; color: black;">';

print '<br /><p>The main item on this page can only be selected together with the related items shown below on the 
<a href="http://litez.co.uk/' . $app . '-catshow/' . $prodcat . '.html" rel="external">main category page</a> for this item; however, the 
main item can be selected on its own, as can any of the related items, using the <strong>Add To Purchase</strong> button at the top of the listing for the 
main item, or the <strong>Add To Purchase List</strong> button at the bottom of the listing for the related items.</p><br />';

          print '</div>

          </div></div>
          </div></div>

          </div></div>
          </div></div>
          </div><br />';

     } elseif ($wurflObj->getDeviceCapability("is_wireless_device")) {

          if (($noproductoptions == '1') && ($notradeprice == '1')) {

               print '<div style="text-align: center; color: black;">

               <div class="tm">
               <div class="b">

               <div class="l">
               <div class="r">

               <div class="bl">
               <div class="br">

               <div class="tl">
               <div class="tr">

               <div style="text-align: justify; font-size: smaller; color: black;">';

print '<br /><p><img src="/images/options_small.png" alt="Item Has Options" /> <strong>=</strong> Item has additional options, which it is not necessary to 
select in order to add it to your <strong>Prchase List</strong>, and which can viewed by clicking on the item image in order to view full details for that 
product.</p><br />';

print '<br /><p><img src="/images/trade_small.png" alt="Item Is Trade Price" /> <strong>=</strong> Trade price item.</p><br />';

          } elseif (($noproductoptions == '1') || ($notradeprice == '1')) {

               print '<div style="text-align: center; color: black;">

               <div class="tm">
               <div class="b">

               <div class="l">
               <div class="r">

               <div class="bl">
               <div class="br">

               <div class="tl">
               <div class="tr">

               <div style="text-align: justify; font-size: smaller; color: black;">';

               if ($noproductoptions == '1') {

print '<br /><p><img src="/images/options_small.png" alt="Item Has Options" /> <strong>=</strong> Item has additional options, which it is not necessary to 
select in order to add it to your <strong>Prchase List</strong>, and which can viewed by clicking on the item image in order to view full details for that 
product.</p><br />';

               } elseif ((!preg_match('/Litez_|PhotoFlora/',$catid)) && ($notradeprice == '1')) {

print '<br /><p><img src="/images/trade_small.png" alt="Item Is Trade Price" /> <strong>=</strong> Trade price item.</p><br />';

               } // End of if statement.

          } // End of if statement.

          print '</div>

          </div></div>
          </div></div>

          </div></div>
          </div></div>
          </div><br />';

     } elseif ((!preg_match('/Litez_|PhotoFlora/',$catid)) && ($notradeprice == '1')) {

          print '<div style="text-align: center; color: black;">

          <div class="tm">
          <div class="b">

          <div class="l">
          <div class="r">

          <div class="bl">
          <div class="br">

          <div class="tl">
          <div class="tr">

          <div style="text-align: center; font-size: smaller; color: black;">';

print '<br /><p><img src="/images/trade_small.png" alt="Item Is Trade Price" /> <strong>=</strong> Trade price item.</p><br />';

          print '</div>

          </div></div>
          </div></div>

          </div></div>
          </div></div>
          </div><br />';

     } // End of if statement.

if (empty($showsort)) {$supsort = 1;}

// +--
// | In this step we determine whether we will be showing
// | images in this display.
// +--

$multi_images = 0;

foreach ($prodlist as $num => $prod) {

     if ((!(empty($prod['imgsm']))) && ($prod['imgsm'] != 'none.png')) {$multi_images = 1;}

} // End of foreach statement.

// +--
// | Define the header text.
// +--

$header   = $this->globals('ecom.prod_store_header');

if (empty($header)) {

     if ($ns == 'prodshow') {$header = 'Related Items';} else {$header = 'Items';}

} else {

     $header .= ' Featured Items';

} // End of if statement.

$header   = $this->xhtml_encode($header);

$random  = 'x' . $this->random_key(8);

// +--
// | Print the form opener.
// +--

$nsid     = 'ns';
$formid   = $app . '--prodaddtocartM';

$this->xhtml_quickform_header($formid,$app,'addcart',array($nsid => $ns));

print '<table id="khxc--cptbl--' . $random . '" class="khxc_sorttable" rules="rows" frame="hsides" cellpadding="5px">' . $eol . $eol;

      // +--
      // | Print a table row opener.
      // +--

      print '<tr>' . $eol . $eol;

// +--
// | Loop through the products.
// +--

$counter = 0;

foreach ($prodlist as $num => $prod) {
      //Leave the below line at the top of the loop
      $counter++; //Increment the counter with each product
                  //The counter starts at 1 and counts up

     // +--
     // | Print the tds and their content.
     // +--

     $prodname    = $this->xhtml_encode($prod['name']);
     $prodid      = $this->xhtml_encode($prod['id']);
     $prodlink    = $this->link_namespace($app,'prodshow',$prod['id']);
     $proddesc    = $this->xhtml_encode($prod['descshort']);
     $imgname     = $prod['imgsm'];
     $prodoptions = $prod['xprodoptions'];
     $prodnum     = $prod['prodnum'];
     $title       = $prod['short_title'];
     $tagline     = $prod['ptag'];
     $shortdesc   = $prod['descshort'];
     $brand       = $prod['brand'];
     $model       = $prod['model'];
     $pricestatus = $prod['pricestatus'];
     $clearance   = $prod['clearance'];

     $catshow     = $this->globals('ecom.cat_catshow');
     $catid       = $catshow['id'];
     $catline     = $catshow['ctag'];

     $add_ok = 1;

     if (($prod['useinv']) && (!($prod['invlevel'] > 0))) {$add_ok = 0;}
     if ($prod['pricestatus'] == 'D') {$add_ok = 0;}

     $quandisp = 1;
     $quanform = $this->globals('khxc_cgi.' . $formid . '--' . $prodid . '--quantity');

     if (isset($quanform)) {$quandisp = $quanform;}

     $image_ok = 0;

     if ((!(empty($imgname))) && ($imgname != 'none.png')) {$image_ok = 1;}

     if ($image_ok) {

          $imgurl   = 'media/' . $app . '/prodsm/' . $imgname;

     if ((!empty($prodoptions)) && ($wurflObj->getDeviceCapability("is_wireless_device"))) {

$imgtag   = '<div style="z-index: 2; position: relative; top: 20px; left: 80px;" alt="Item Has Product Options" title="Item Has Product 
Options"><img src="/images/options_small.png" alt="Item Has Product Options" /><a href="' . $prodlink . '" title="' . $prodname . '"></div>';

          if ($clearance == '1') {

$imgtag   = '<div style="z-index: 2; position: relative; top: 40px; left: 80px;" alt="Item Is Trade Price &amp; Has Product Options" 
title="Item Is Trade Price &amp; Has Product Options"><img src="/images/trade_small.png" alt="Item Is Trade Price &amp; Has Product 
Options" /><a href="' . $prodlink . '" title="' . $prodname . '"></div><div style="z-index: 2; position: relative; top: 60px; left: 80px;" alt="Item Is 
Trade Price &amp; Has Product Options" title="Item Is Trade Price &amp; Has Product Options"><img src="/images/options_small.png" alt="Item Is Trade Price 
&amp; Has Product Options" /><a href="' . $prodlink . '" title="' . $prodname . '"></div>';

          } // End of if statement.

     } elseif ($clearance == '1') {

$imgtag   = '<div style="z-index: 2; position: relative; top: 20px; left: 80px;" alt="Trade Price" title="Trade Price"><img src="/images/trade_small.png" 
alt="Trade Price" /><a href="' . $prodlink . '" title="' . $prodname . '"></div>';

     } else {

$imgtag   = '<a href="' . $prodlink . '" title="' . $prodname . '">';

     } // End of if statement.

$imgtag  .= '<img src="' . $imgurl . '" ';

     if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}

$imgtag  .= 'alt="' . $prodname . '" /></a>';

print '<td style="vertical-align: middle; padding: 5px 0 0 0; width: 100px;">' . $imgtag;

print '<p style="text-align: left; width: 100px;"><a href="' . $prodlink . '" title="' . $prodname . '">';

print $title . '</a></p></td>' . $eol . $eol;

      } else {

          if ($multi_images) {

               print '<td>&nbsp;</td>' . $eol . $eol;

          } // End of if statement.n

      } // End of if statement.

     print '<td style="vertical-align: top; width: 30%;">';

     $this->globals('ecom.prod_proddisp',$prod);

if ($proddesc) {

     if ($prodnum == 'LDW_Cut_Wire_Cable_Flex') {

$addendum = '  <span style="color: red;">** Click on image for flex colour options and to enter cut length requirements **</span>';
$proddesc .= $addendum;

     } elseif ($brand == 'Litez') {

          if ($prodnum == 'Litez_Heavi_Bitz') {

$promotion = '  <span style="color: red;">** Own bottle supplied lamps now just &pound;12.50  - click the image for more details **</span>.';
$proddesc .= $promotion;
     
          } elseif ($pricestatus == 'V') {

$addition = '  <span style="color: red;">Click on the image for full details and complete item options</span>.';
$proddesc .= $addition;

          } elseif ($pricestatus == 'R') {

$promotion = '  <span style="color: red;">** Short duration special price **</span>.';
$proddesc .= $promotion;

          } // End of if statement.

     } // End of if statement.

} // End of if statement.

     print '<p style="text-align: justify; color: black; padding-right: 5px;">' . $proddesc . '</p><br/>';

     if (($add_ok) && ($brand == 'Litez')) {

          print '<div class="hidden">';

          $this->include_namespace($app,'prodshowoptlite',array('form' => $formid . '--' . $prodid, 'showquan' => 0, 'headfoot' => 0));

          print '</div>';

     } elseif (($add_ok) && ($prodnum == 'LDW_Cut_Wire_Cable_Flex')) {

          print '<div class="hidden">';

          $this->include_namespace($app,'prodshowoptlite',array('form' => $formid . '--' . $prodid, 'showquan' => 0, 'headfoot' => 0));

          print '</div>';

     } elseif ($add_ok) {

          if ($wurflObj->getDeviceCapability("is_wireless_device")) {

               print '<div class="hidden">';

               $this->include_namespace($app,'prodshowoptlite',array('form' => $formid . '--' . $prodid, 'showquan' => 0, 'headfoot' => 0));

               print '</div>';

          } else {

               $this->include_namespace($app,'prodshowoptlite',array('form' => $formid . '--' . $prodid, 'showquan' => 0, 'headfoot' => 0));

          } // End of if statement.

     } // End of if statement.
 
     $this->globals('ecom.prod_priceinfo',$prod['khxc.priceinfo']);

     $this->include_file($app,'pricedisp.php');

     if ((!empty($brand)) && (!empty($model))) {

          print '<p style="color: black; font-weight: bold;">' . $brand . ' - ' . $model . '</p>';

     } elseif (!empty($brand)) {

          print '<p style="color: black; font-weight: bold;">' . $brand . '</p>';

     } // End of if statement.

     print '<br />';

     if ($add_ok) {

          print '<label for="' . $formid . '--' . $prodid . '--quantity';
          print '" class="hidden">Quantity</label>' . $eol;
          print '<input class="khxc_formfield_box" type="checkbox" name="';
          print $formid . '--' . $prodid . '--quantity';
          print '" id="' . $formid . '--' . $prodid . '--quantity';
          print '" value="' . $quandisp . '" size="5" maxlength="5" /> <span style="font-style: normal; display: inline-block; color: black; 
          font-size: 0.7em; font-weight: bold;">Click Box To Select<br />...Then Add To Purchase List</span>' . $eol;

     } else {

          print '<label for="' . $formid . '--' . $prodid . '--quantity';
          print '" class="hidden">Quantity</label>' . $eol;
          print '<p class="hidden"><input type="hidden" name="';
          print $formid . '--' . $prodid . '--quantity';
          print '" id="' . $formid . '--' . $prodid . '--quantity';
          print '" value="' . $quandisp . '" /></p>' . $eol;

     } // End of if statement.

     print '</td>' . $eol . $eol;

     if ($counter == 2) {

     print '</tr>' . $eol . $eol;

     print '<tr>' . $eol . $eol;

     $counter = 0;

     } // End of if statement.

     } // End of foreach statement.

// +--
// | Print the table closure.
// +--

print '<td>&nbsp;</td></tr></table><p>&nbsp;</p>' . $eol . $eol;

// +--
// | Print the form closure.
// +--

$this->xhtml_quickform_footer($formid,'Add To Purchase List',1);

?>

Last edited by Design_Wholesale (01-19-2011 14:24:54)

Offline

 

#4 01-20-2011 05:56:10

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: This Is Simple, But I'm Damned If I Know How To Implement It...

The xprodoptions key is a comma delimited list if I'm not mistaken. Explode it and check the number of entries in the resulting array to determine how many options there are.

Offline

 

#5 01-22-2011 13:29:14

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Re: This Is Simple, But I'm Damned If I Know How To Implement It...

I've now managed to have a look at the  function, but, unfortunately, it won't work for what I need. - The product options are contained in entries in the  table and cannot be exploded, ditto for  (which should be perfectly explodable) apart from which there seems to be no way to call them, as there is for product options (  ).

I've also looked at ways of trying to call the product options, if present, etc., etc. and doing things that way but, again, there is no way to access them short of rewriting everything as a massive MySQL statement (which totally kills the resources on my server).

works on its own, no problem, - just not for things like splitting up product options so I can check whether there is more than product option, it would seem.

Last edited by Design_Wholesale (01-22-2011 13:41:30)

Offline

 

Board footer