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 12-27-2012 16:56:41

goski
Member
Registered: 09-27-2005
Posts: 115

New Product Detail Display

In Version 7, I created a new Product Detail Display named "Price Below Image" so the volume pricing shows below the Email to a Friend.  This was done by moving the code

<?php $this->include_file('ecom','pricedisp.php'); ?> 

above the closing </td> tag that holds the image.

Can any tell me what code to move in Version 8 and where to move it to achieve the same results?

Offline

 

#2 12-28-2012 08:35:26

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: New Product Detail Display

This is actually fairly complicated to do in v8 because the price display also prints the add to cart's quantity form field).  I've modified the default display below, moving the price display to under the image (without the quantity form field) and added the quantity form field into the display under the description.  This should give you some idea of what you need to accomplish your task:

Code:

<?php 

// +--
// | Get variables we need to draw this display.
// +--

$eol         = $this->globals('core.eol');
$proddisp    = $this->globals('ecom.prod_proddetail');
$xid         = $proddisp['id'];
$id          = $this->xhtml_encode($xid);
$imgwidth    = $this->globals('core_settings.ecom.imgsizeprodlg');

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

// +--
// | Set the add ok flag.
// +--

$add_ok = 1;

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

// +--
// | Determine where the extras include will be placed.
// +--

$placeextras = 'BELOWIMAGE';

$images = $this->check_images(array('prodlg' => array('root' => 'PUBLIC', 'dir' => 'media/ecom/prodlg', 'list' => $proddisp['imglg'])));

if ((!(empty($images['prodlg']))) && ($proddisp['useinv']) && (!($proddisp['invlevel'] > 0))) {$placeextras = 'BELOWPRICE';}

// +--
// | Create the product name and description.
// +--

$prodname  = $this->xhtml_encode($proddisp['name']);
$proddesc  = $proddisp['desclong'];
$desc_has_tags = $this->has_tags($proddesc);

if (empty($proddesc)) {

     $proddesc       = $proddisp['descshort'];
     $desc_has_tags  = 0;

} // End of if statement.

if (empty($desc_has_tags)) {$proddesc = '<p>' . $this->xhtml_encode($proddesc) . '</p>';}

// +--
// | Print the display.
// +--

print '<div class="ecom_prodshow">' . $eol;

print '<table class="invisible">' . $eol;

print '<tr>';

print '<td class="invisible" style="width: ' . $imgwidth . 'px; padding: 0px 20px 4px 0px;">' . $eol;

// +--
// | Print the image and figure out where to put the 
// | extras include.
// +--

$this->include_file('ecom','prodshowimg.php');

// +--
// | Print the extras include if it's position is BELOWIMAGE.
// +--

if ($placeextras == 'BELOWIMAGE') {

     $this->include_file('ecom','prodshowextras.php');

     $this->globals('ecom.prod_priceinfo',$proddisp['core.priceinfo']);
     $this->globals('ecom.disp_priceinfo','left');
     $this->globals('ecom.reviews_priceinfo',0);
     $this->globals('ecom.loyaltypoints_showworth_priceinfo',1);

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

} // End of if statement.

print '</td>' . $eol;

print '<td class="invisible" style="padding: 0px 0px 4px 0px;">' . $eol;

print '<div class="proddetdesc">' . $eol;
print $proddesc . $eol;
print '</div>' . $eol;

// +--
// | Set up the add to cart form.
// +--

$formid  = 'ecom--prodaddtocart--' . $proddisp['id'];
$inputid = $formid . '--quantity';

if  (!(empty($add_ok))) {

     $this->xhtml_quickform_header($formid,'ecom','addcart',array());

} // End of if statement.

// +--
// | Print the price display.
// +--

if  (!(empty($add_ok))) {

     $tid = $proddisp['id'] . '--priceautoupdate';

     $loadingimg  = '<img src="media/core/images/loading_12x12.gif" width="12" height="12" ';
     $loadingimg .= 'style="display: inline-block; with: 12px; height: 12px" alt="Loading" />';

     $display .= '<tr><td class="ecom_pricedisp_autoname"><div id="' . $tid . '--name" style="display: none;">Your Total:</div></td>' . $eol;
     $display .= '<td class="ecom_pricedisp_autoprice"><div id="' . $tid . '--price" style="display: none;">' . $loadingimg . '</div></td></tr>' . $eol;

     $js_docready = 'jQuery(\'#' . $tid . '--name, #' . $tid . '--price\').css({\'display\': \'block\'});';

     $this->append_global_array('core.js_docready',$js_docready);

     $value = $this->globals('core_cgi.' . $inputid);if (empty($value)) {$value = 1;}
     $value = $this->xhtml_encode($value);

     print '<p class="hidden"><label for="' . $formid . '--quantity';
     print '" class="hidden">Quantity</label></p>' . $eol;

     $display .= '<tr><td class="ecom_pricedisp_quanname">Quantity:</td>' . $eol;
     $display .= '<td class="ecom_pricedisp_quaninput">';

     $display .= '<input class="formfield" style="margin: 0px;" type="text" name="' . $inputid . '" ';
     $display .= 'id="' . $inputid . '" value="' . $value . '" size="3" maxlength="5" />';

     $display .= '</td></tr>' . $eol;

     $js_options   = '{\'formid\': \'' . $formid . '\', \'inputid\': \'' . $inputid . '\'}';

     $js_docready  = 'jQuery(\'#' . $inputid . '\').keyup(function(){';
     $js_docready .= 'if (window.mytimeout) {window.clearTimeout(window.mytimeout);} ';
     $js_docready .= 'window.mytimeout = window.setTimeout(function(){';
     $js_docready .= 'return priceAutoUpdate(' . $js_options . ');';
     $js_docready .= '}, 1200);});';

     $js_docready .= 'priceAutoUpdate(' . $js_options . ');';

     $this->append_global_array('core.js_docready',$js_docready);

     print '<table class="ecom_pricedisp_left">' . $eol;
     print $display;
     print '</table>' . $eol;

} // End of if statement.

// +--
// | Print the extras include if it's position is BELOWPRICE.
// +--

if ($placeextras == 'BELOWPRICE') {

     $this->globals('ecom.prod_priceinfo',$proddisp['core.priceinfo']);
     $this->globals('ecom.disp_priceinfo','left');
     $this->globals('ecom.reviews_priceinfo',0);
     $this->globals('ecom.loyaltypoints_showworth_priceinfo',1);

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

     print '<div style="height: 22px;"></div>' . $eol;

     $this->include_file('ecom','prodshowextras.php');

} // End of if statement.

// +--
// | Print the add buttons and product options if we can add the 
// | item to the shopping cart or wish list.  Also print the form closure.
// +--

if  (!(empty($add_ok))) {

     $this->globals('core.formfields_ajax_function','priceAutoUpdate');

     $this->include_namespace('ecom','prodshowoptlite',array('form' => $formid, 'showquan' => 0, 'headfoot' => 0, 'sections' => 1));

     $this->globals('core.formfields_ajax_function','');

     if (!(empty($proddisp['xprodoptions']))) {

          print '<div style="height: 5px;"></div>' . $eol;

     } // End of if statement.

     $enablewl = $this->globals('core_settings.ecom.enablewishlist');

     print '<p><input class="formbutton" type="submit" name="SUBMIT" id="' . $formid . '--SUBMIT" value="Add to Cart" />';

     if (!(empty($enablewl))) {

          print ' <input class="formbutton" type="submit" name="WISHLIST" id="' . $formid . '--WISHLIST" value="Add to Wishlist" />';

     } // End of if statement.

     print '</p>' . $eol;

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

} // End of if statement.

print '</td>';

print '</tr>' . $eol;

print '</table>' . $eol;

print '</div>' . $eol;

// +--
// | Print the tabs include.
// +--

$this->include_file('ecom','prodshowtabs.php');

?>

Nick Hendler

Offline

 

#3 12-28-2012 14:16:50

goski
Member
Registered: 09-27-2005
Posts: 115

Re: New Product Detail Display

Thanks Nick.  I tried creating a new Product Detail Display with your code but nothing displays.  I'm not sure if your code was intended to be working code or a starting point.  You are correct that it is much more complicated than Version 7 and well beyond my coding abilities. I'm trying to make as many changes that I can do.  Then I'll prepare a list of requirements for you to price out like we did for Version 7.

Offline

 

#4 12-28-2012 14:23:55

goski
Member
Registered: 09-27-2005
Posts: 115

Re: New Product Detail Display

Sorry Nick.  When I did my cut and paste I didn't pick up all of your code.  Seems to work just fine. Thanks for your help.

Offline

 

Board footer