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.

#26 06-19-2007 13:52:40

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Update cart quantity from product display.

What I did to get the link in the cart to point back to the main display item was I created a new column in the products database.
In admin at Home > Kryptronic Hybrid X Core > Database: Connections, Backups and Raw Admin > Raw Database Admin clicked on Matain for ccp0_prod and created the column name mainlink (you can name this anything you like). This data field will hold the item id of the main display for the size products.

Then in your private directory private/apps/{app}/CCP_Cart edit CCP_Cart.php and in Function: build_item look for this code near the bottom :

Code:

$item = array('randid'          => $this->random_key(12),
              'id'              => $product['id'],
              'quantity'        => $quantity,
              'name'            => $product['name'],
              'number'          => $product['prodnum'],
              'imgsm'           => $product['imgsm'],
              'prodinv'         => $product['useinv'],
              'optdisp'         => $optnamevals,
              'optselids'       => $optselids,
              'optinv'          => $optinv,
              'dlfiles'         => $dlfiles,
              'delmethod'       => $product['delmethod'],
              'sinshipinfo'     => $sinshipinfo,
              'shipemail'       => $shipemail,
              'sinprodprice'    => $sinprodprice,
              'sinoptprice'     => $sinoptprice,
              'sinaffcomm'      => $sinaffcomm,
              'istaxsp'         => $product['taxstateprov'],
              'istaxc'          => $product['taxcountry'],
              'subtotal'        => $subtotal,
              'subtotalrec'     => $subtotalrec,
              'url'             => $url,
              'addemtext'       => $product['addemtext']);

and add a entrie for the product column you just created to get in into the order array like (I am useing the name I created but you would have to use the name of your field)

Code:

$item = array('randid'          => $this->random_key(12),
              'id'              => $product['id'],
              'quantity'        => $quantity,
              'name'            => $product['name'],
              'number'          => $product['prodnum'],
              'imgsm'           => $product['imgsm'],
              'prodinv'         => $product['useinv'],
              'optdisp'         => $optnamevals,
              'optselids'       => $optselids,
              'optinv'          => $optinv,
              'dlfiles'         => $dlfiles,
              'delmethod'       => $product['delmethod'],
              'sinshipinfo'     => $sinshipinfo,
              'shipemail'       => $shipemail,
              'sinprodprice'    => $sinprodprice,
              'sinoptprice'     => $sinoptprice,
              'sinaffcomm'      => $sinaffcomm,
              'istaxsp'         => $product['taxstateprov'],
              'istaxc'          => $product['taxcountry'],
              'subtotal'        => $subtotal,
              'subtotalrec'     => $subtotalrec,
              'url'             => $url,
              'addemtext'       => $product['addemtext'],
              'mainlink'        => $product['mainlink']);

it dosn't matter where you put the new array key I put mine at the end.

Then in private/apps/{app}/CCP/includes edit cartdisplay.php and look for (this is also reachable in the front end xhtml includes in Shopping Cart/Wish List Display)

Code:

               $link = $cartdata['url'];

               if ($link == 'INTERNAL') {

                     $link = $this->link_namespace($app,'prodshow',array('ref' => $cartdata['id']));

               } elseif ($link == 'REMOTE') {

and change it like this but use the name of the key you did in the build_item code ( I am posting my code here).

Code:

               $link = $cartdata['url'];

               if ($link == 'INTERNAL') {

                  if ($cartdata['mainlink']) {

                     $link = $this->link_namespace($app,'prodshow',array('ref' => $cartdata['mainlink']));

                   } else {

                     $link = $this->link_namespace($app,'prodshow',array('ref' => $cartdata['id']));

                 } // End of if statement.

               } elseif ($link == 'REMOTE') {

This is the way I did mine so the script would know which items are from this type of multi add item but if all you sell are shirts you could make this easier with a preg_replace statement in the shopping cart display script. But this would require you to keep a uniform id naming schem so you would now what to cut off to get to the main item id.

John

Last edited by dh783 (06-19-2007 13:55:11)

Offline

 

#27 06-19-2007 14:26:46

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

Wow. Nice work, John smile I'll give that a go. I appreciate you posting that.

John

Offline

 

#28 01-21-2011 12:32:43

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

I'm revisiting this after a some years as I've been asked to do some updates on the site. I'm very close on this modification, but I need to do a couple things that I'm not sure how to accomplish.

Here an image of what I have
and here's an image from

I want it to look like John's site with the image column gone and the links to be deactivated. I've been trying a few different things, still working on it. John, maybe you could point me in the right direction as to how you did that on your site?

-John

Offline

 

#29 01-21-2011 13:18:24

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Update cart quantity from product display.

Since the actual items in this mod have there visibility set to "Not viewable by anyone" (which is an N in the database field) I placed a check for that value in the product multi add include where the images and links are being built so that it would not allow them if the product being viewed was set to not be viewed by anyone. So this is what I currently have in my prodmulti include script (prodmulti.php)

I have this at the top of the script

Code:

$multi_images = 0;

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

// +---
// | SLP edit prodview.
// +---

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

} // End of foreach statement.

Code:

// +---
// | SLP edit added  prodview=N to if statememnt.
// +---

      if ((!(empty($imgname))) && ($imgname != 'none.png') && ($prod['prodview'] != 'N')) {$image_ok = 1;}

      if ($image_ok) {

           $imgurl   = 'media/ecom/prodsm/' . $imgname;
           $imgtag   = '<a href="' . $prodlink . '" title="' . $prodname . '">';
           $imgtag  .= '<img src="' . $imgurl . '" ';
           if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
           $imgtag  .= 'alt="' . $prodname . '" /></a>';

           print '<td class="' . $tdclass . '">' . $imgtag . '</td>' . $eol . $eol;

      } else {

          if ($multi_images) {

               print '<td class="' . $tdclass . '">&nbsp;</td>' . $eol . $eol;

          } // End of if statement.

      } // End of if statement.

      print '<td class="' . $tdclass . '">';

// +---
// | SLP edit teeshirt mod next two if statments.
// +---

   if ($prod['prodview'] != 'N') {

      print '<p><a href="' . $prodlink . '" title="' . $prodname . '">';
      print $prodname . '</a></p>' . $eol;

   } // End of if statement.

   if ($prod['prodview'] != 'N') {

      if (!(empty($proddesc))) {print '<p>' . $proddesc . '</p>' . $eol;}

   } else {

      print '<p>' . $prod['name'] . '</p>' . $eol;

  } // end of if statement.

// +---
// | end edit.
// +---

      $this->globals('ecom.prod_proddisp',$prod);
      $this->globals('ecom.prod_priceinfo',$prod['khxc.priceinfo']);

this area should be near the bottom of the script, I don't have the original script to post the difference but it was to basically to just change the first if statement  (above) and add to others to surround the links creation code.

John

Last edited by dh783 (01-21-2011 15:33:36)

Offline

 

#30 01-21-2011 13:40:58

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

Thanks, John! I'll give that a try. Here is the original piece of code for that second part to help others find it (not sure if you're replacing all of this, though. will test):

Code:

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

      if ($image_ok) {

           $imgurl   = 'media/' . $app . '/prodsm/' . $imgname;
           $imgtag   = '<a href="' . $prodlink . '" title="' . $prodname . '">';
           $imgtag  .= '<img src="' . $imgurl . '" ';
           if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
           $imgtag  .= 'alt="' . $prodname . '" /></a>';

           print '<td class="' . $tdclass . '">' . $imgtag . '</td>' . $eol . $eol;

      } else {

          if ($multi_images) {

               print '<td class="' . $tdclass . '">&nbsp;</td>' . $eol . $eol;

          } // End of if statement.

      } // End of if statement.

      print '<td class="' . $tdclass . '">';

      print '<p class="hidden"><input type="hidden" id="' . $app . '--prodaddtocart--ref--';
      print $num . '" name="' . $app . '--prodaddtocart--ref--' . $num . '" value="';
      print $prodid . '" /></p>' . $eol;

      print '<p><a href="' . $prodlink . '" title="' . $prodname . '">';
      print $prodname . '</a></p>' . $eol;

      if (!(empty($proddesc))) {print '<p>' . $proddesc . '</p>' . $eol;}

      $this->globals('ecom.prod_proddisp',$prod);
      $this->globals('ecom.prod_priceinfo',$prod['khxc.priceinfo']);
           
      $this->include_file($app,'pricedisp.php');

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

Offline

 

#31 01-21-2011 13:46:21

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

That is perfect, John! Thanks so much, you just saved me a lot of time. Much appreciated. Here's the

Offline

 

#32 01-21-2011 15:14:59

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

John, as soon as I add that last bit of code, it looks the way I want it, but I get an error when I try to add items to the cart.



Works fine when I revert back to the original. This is what I have, I'm replacing this code:

Code:

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

      if ($image_ok) {

           $imgurl   = 'media/' . $app . '/prodsm/' . $imgname;
           $imgtag   = '<a href="' . $prodlink . '" title="' . $prodname . '">';
           $imgtag  .= '<img src="' . $imgurl . '" ';
           if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
           $imgtag  .= 'alt="' . $prodname . '" /></a>';

           print '<td class="' . $tdclass . '">' . $imgtag . '</td>' . $eol . $eol;

      } else {

          if ($multi_images) {

               print '<td class="' . $tdclass . '">&nbsp;</td>' . $eol . $eol;

          } // End of if statement.

      } // End of if statement.

      print '<td class="' . $tdclass . '">';

      print '<p class="hidden"><input type="hidden" id="' . $app . '--prodaddtocart--ref--';
      print $num . '" name="' . $app . '--prodaddtocart--ref--' . $num . '" value="';
      print $prodid . '" /></p>' . $eol;

      print '<p><a href="' . $prodlink . '" title="' . $prodname . '">';
      print $prodname . '</a></p>' . $eol;

      if (!(empty($proddesc))) {print '<p>' . $proddesc . '</p>' . $eol;}

      $this->globals('ecom.prod_proddisp',$prod);
      $this->globals('ecom.prod_priceinfo',$prod['khxc.priceinfo']);

With this code:

Code:

// +---
// | edit added  prodview=N to if statememnt.
// +---

      if ((!(empty($imgname))) && ($imgname != 'none.png') && ($prod['prodview'] != 'N')) {$image_ok = 1;}

      if ($image_ok) {

           $imgurl   = 'media/ecom/prodsm/' . $imgname;
           $imgtag   = '<a href="' . $prodlink . '" title="' . $prodname . '">';
           $imgtag  .= '<img src="' . $imgurl . '" ';
           if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
           $imgtag  .= 'alt="' . $prodname . '" /></a>';

           print '<td class="' . $tdclass . '">' . $imgtag . '</td>' . $eol . $eol;

      } else {

          if ($multi_images) {

               print '<td class="' . $tdclass . '">&nbsp;</td>' . $eol . $eol;

          } // End of if statement.

      } // End of if statement.

      print '<td class="' . $tdclass . '">';

// +---
// | edit teeshirt mod next two if statments.
// +---

   if ($prod['prodview'] != 'N') {

      print '<p><a href="' . $prodlink . '" title="' . $prodname . '">';
      print $prodname . '</a></p>' . $eol;

   } // End of if statement.

   if ($prod['prodview'] != 'N') {

      if (!(empty($proddesc))) {print '<p>' . $proddesc . '</p>' . $eol;}

   } else {

      print '<p>' . $prod['name'] . '</p>' . $eol;

  } // end of if statement.

      $this->globals('ecom.prod_proddisp',$prod);
      $this->globals('ecom.prod_priceinfo',$prod['core.priceinfo']);

Am I placing that right? I don't see what is throwing the error. Any ideas?

Last edited by JGB (01-21-2011 15:21:12)

Offline

 

#33 01-21-2011 15:31:40

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Update cart quantity from product display.

This last code should not have any effect on getting items into the cart, I would say that you may have to turn on the debugger and see what is returned. The code I posted was straight out of my site (ccp7) the only difference is in the very last statement in my post which replaced khxc with core, but that line shouldn't have been changed, I only included it so that you could see the general area so make sure that line stays like

Code:

$this->globals('ecom.prod_priceinfo',$prod['khxc.priceinfo']);

for ccp6, sorry if this messed you up.

John

Offline

 

#34 01-21-2011 16:48:20

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

No problem, John. I made that change and looked at the debugger, I'm not familiar enough with that to know what it means, but nothing jumps out as obviously wrong. Still getting the same error. I checked the database, the proper files are set to N with the two selections for Superuser and User.

Here's the entire prodmulti.php script, if you wouldn't mind taking a look. Maybe you'll see something I'm missing. I must  have something screwed up in there.

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');
$incdisp   = $this->globals('ecom.prod_incdisp');
$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');
if (empty($showsort)) {$supsort = 1;}

$prodcount = count($prodlist);

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

$multi_images = 0;

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

// +---
// | Edit prodview.
// +---

     if ((!(empty($prod['imgsm']))) && ($prod['imgsm'] != 'none.png') && ($prod['prodview'] != 'N')) {$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 = 'Select Item and Quantity Below.';} else {$header = 'Items';}

} else {

     $header .= ' Featured Items';

} // End of if statement.

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

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

// +--
// | Print the products header.
// +--

print '<div class="khxc_storehead">' . $header . '</div>' . $eol . $eol;

// +--
// | Print sort options if we are not in the prodshow namespace and
// | we are viewing more than one product or we are within a product
// | result set.
// +--

if ((!($supsort)) && ($ns != 'prodshow') && (($prodcount > 1) || (!(empty($navarray))))) {

     $sortinfo  = $this->globals('khxc_session.prodsort');

     $link_default = $this->link_namespace($app,$ns,array('ref' => $ref,'prodsort' => 'DEFAULT'));
     $link_nameup  = $this->link_namespace($app,$ns,array('ref' => $ref,'prodsort' => 'NAMEUP'));
     $link_namedn  = $this->link_namespace($app,$ns,array('ref' => $ref,'prodsort' => 'NAMEDN'));
     $link_priceup = $this->link_namespace($app,$ns,array('ref' => $ref,'prodsort' => 'PRICEUP'));
     $link_pricedn = $this->link_namespace($app,$ns,array('ref' => $ref,'prodsort' => 'PRICEDN'));

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

     print '<p><strong>Sort by</strong>: ';

     print '<a href="' . $link_default . '" title="DEFAULT">Default</a> | ';
     print 'Name <a href="' . $link_nameup  . '" title="NAMEUP">[+]</a> ';
     print '<a href="' . $link_namedn  . '" title="NAMEDN">[-]</a> | ';
     print 'Price <a href="' . $link_priceup . '" title="PRICEUP">[+]</a> ';
     print '<a href="' . $link_pricedn . '" title="PRICEDN">[-]</a>';


     if     ($sortinfo == 'NAMEUP')  {print ' <strong>Current</strong>: Name [+]';}
     elseif ($sortinfo == 'NAMEDN')  {print ' <strong>Current</strong>: Name [-]';}
     elseif ($sortinfo == 'PRICEUP') {print ' <strong>Current</strong>: Price [+]';}
     elseif ($sortinfo == 'PRICEDN') {print ' <strong>Current</strong>: Price [-]';}
     else                            {print ' <strong>Current</strong>: Default';}

     print '</p>' . $eol;
     print '</div>' . $eol;

} // End of if statement.

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

$nsid     = $app . '--prodaddtocart--ns';
$refid    = $app . '--prodaddtocart--ref';
$typeid   = $app . '--prodaddtocart--addtype';
$countid  = $app . '--prodaddtocart--count';
$formid   = $app . '--prodaddtocart--MULTIPLE';

$this->xhtml_quickform_header($formid,$app,'addcart',array($nsid => $ns, $refid => $ref, $countid => $prodcount, $typeid => 'MULTIPLE'));

// +--
// | Print multi-add table header.
// +--

if (empty($disablewl)) {

     print '<p>Enter a quantity for each item you would like to add to your 
            shopping cart or wish list then click the \'Add To Cart\' 
            or \'Add To Wish List\' button at the bottom of the listing to 
            proceed.</p>';

} else {

     print '<p>Enter a quantity for each item you would like to add to your 
            shopping cart then click the \'Add To Cart\' button at the bottom 
            of the listing to proceed.</p>';

} // End of if statement.

print '<table id="khxc--cptbl--' . $random . '" class="khxc_sorttable">' . $eol . $eol;

$trclass = 'khxc_sorttable';
$tdclass = 'khxc_sorttable';

print '<tr class="khxc_sorttable">' . $eol . $eol;

print '<th class="khxc_sorttable">Quantity</th>' . $eol;

if ($multi_images) {

     print '<th class="khxc_sorttable">Image</th>' . $eol;

} // End of if statement.

print '<th class="khxc_sorttable">Item</th>' . $eol;

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

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

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

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

      print '<tr class="' . $trclass . '">' . $eol . $eol;

      // +--
      // | 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'];

      $add_ok = 1;

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

      if ($add_ok) {

           print '<td class="' . $tdclass . '">' . $eol . $eol;
           print '<label for="' . $app . '--prodaddtocart--quantity--' . $num;
           print '" class="hidden">Quantity</label>' . $eol;
           print '<input class="khxc_formfield" type="text" name="';
           print $app . '--prodaddtocart--quantity--' . $num;
           print '" id="' . $app . '--prodaddtocart--quantity--' . $num;
           print '" value="0" size="5" maxlength="5" />' . $eol;
           print '</td>' . $eol . $eol;

      } else {

           print '<td class="' . $tdclass . '">&nbsp;</td>' . $eol . $eol;

           print '<label for="' . $app . '--prodaddtocart--quantity--' . $num;
           print '" class="hidden">Quantity</label>' . $eol;
           print '<p class="hidden"><input type="hidden" name="';
           print $app . '--prodaddtocart--quantity--' . $num;
           print '" id="' . $app . '--prodaddtocart--quantity--' . $num;
           print '" value="0" /></p>' . $eol;

      } // End of if statement.

      $image_ok = 0;

// +---
// | Edit added  prodview=N to if statememnt.
// +---

      if ((!(empty($imgname))) && ($imgname != 'none.png') && ($prod['prodview'] != 'N')) {$image_ok = 1;}

      if ($image_ok) {

           $imgurl   = 'media/ecom/prodsm/' . $imgname;
           $imgtag   = '<a href="' . $prodlink . '" title="' . $prodname . '">';
           $imgtag  .= '<img src="' . $imgurl . '" ';
           if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
           $imgtag  .= 'alt="' . $prodname . '" /></a>';

           print '<td class="' . $tdclass . '">' . $imgtag . '</td>' . $eol . $eol;

      } else {

          if ($multi_images) {

               print '<td class="' . $tdclass . '">&nbsp;</td>' . $eol . $eol;

          } // End of if statement.

      } // End of if statement.

      print '<td class="' . $tdclass . '">';

// +---
// | Edit teeshirt mod next two if statments.
// +---

   if ($prod['prodview'] != 'N') {

      print '<p><a href="' . $prodlink . '" title="' . $prodname . '">';
      print $prodname . '</a></p>' . $eol;

   } // End of if statement.

   if ($prod['prodview'] != 'N') {

      if (!(empty($proddesc))) {print '<p>' . $proddesc . '</p>' . $eol;}

   } else {

      print '<p>' . $prod['name'] . '</p>' . $eol;

  } // end of if statement.

      $this->globals('ecom.prod_proddisp',$prod);
      $this->globals('ecom.prod_priceinfo',$prod['khxc.priceinfo']);
           
      $this->include_file($app,'pricedisp.php');

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

      // +--
      // | Close the table row.
      // +--

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

} // End of foreach statement.

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

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

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

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

// +--
// | Print navigation links if we have any.
// +--

if (!(empty($navarray))) {

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

} // End of if statement.

?>

Offline

 

#35 01-21-2011 17:43:16

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Update cart quantity from product display.

Can you email me the debug info so I can look and see if I see anything, It was the info for when you clicked to add the items to the cart, right?
The code in these last posts should only deal with the display for the multi add page, which if it is displaying then the code is good, otherwise you would get a display error, but your saying that it doesn't work with it and does without the code inserted, right?

John

Offline

 

#36 01-21-2011 17:48:32

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

Just found this in the product display debug info:

KHXC_Error::error: Non-fatal error encountered: Undefined variable: usergroup File: /apps/ccp0/CCP_Prod/CCP_Prod.php Line: 196

KHXC_Error::error: Non-fatal error encountered: Undefined variable: usergroup File: /apps/ccp0/CCP_Prod/CCP_Prod.php Line: 197

KHXC_Error::error: Non-fatal error encountered: Undefined variable: usergroup File: /apps/ccp0/CCP_Prod/CCP_Prod.php Line: 198

KHXC_Error::error: Non-fatal error encountered: Undefined variable: usergroup File: /apps/ccp0/CCP_Prod/CCP_Prod.php Line: 199

KHXC_Error::error: Non-fatal error encountered: Undefined variable: usergroup File: /apps/ccp0/CCP_Prod/CCP_Prod.php Line: 201

KHXC_Error::error: Non-fatal error encountered: Undefined variable: usergroup File: /apps/ccp0/CCP_Prod/CCP_Prod.php Line: 202

KHXC_Error::error: Non-fatal error encountered: Undefined variable: usergroup File: /apps/ccp0/CCP_Prod/CCP_Prod.php Line: 203

KHXC_Error::error: Non-fatal error encountered: Undefined variable: usergroup File: /apps/ccp0/CCP_Prod/CCP_Prod.php Line: 204


Which deals with this code:

Code:

// | Handle visibility.
// +--

if (empty($usergroup)) {

if ($ns == 'prodshow') {

     if (!(empty($where))) {$where .= 'AND ';}

     $where .= '((prodview=' . $this->KHXC_DB->quote('A') . ') OR ';
     $where .= '(prodview=' . $this->KHXC_DB->quote('L') . ' AND ';
     $where .= '(prodviewg LIKE ' . $this->KHXC_DB->quote_like($usergroup . ',') . ' OR ';
     $where .= 'prodviewg LIKE '  . $this->KHXC_DB->quote_like(','  . $usergroup) . ' OR ';
     $where .= 'prodviewg LIKE '  . $this->KHXC_DB->quote_like(', ' . $usergroup) . ' OR ';
     $where .= 'prodviewg='       . $this->KHXC_DB->quote($usergroup) . '))' . ' OR ';
     $where .= '(prodview=' . $this->KHXC_DB->quote('N') . ' AND ';
     $where .= '(prodviewg LIKE ' . $this->KHXC_DB->quote_like($usergroup . ',') . ' OR ';
     $where .= 'prodviewg LIKE '  . $this->KHXC_DB->quote_like(','  . $usergroup) . ' OR ';
     $where .= 'prodviewg LIKE '  . $this->KHXC_DB->quote_like(', ' . $usergroup) . ' OR ';
     $where .= 'prodviewg='       . $this->KHXC_DB->quote($usergroup) . '))) ';

I'll email you the debug info from both the pages.

Offline

 

#37 01-21-2011 17:59:52

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

dh783 wrote:

The code in these last posts should only deal with the display for the multi add page, which if it is displaying then the code is good, otherwise you would get a display error, but your saying that it doesn't work with it and does without the code inserted, right?

John

If I'm understanding you right, then yes, that's correct. With that code I get an error after clicking "add to cart" on the shopping cart page. It looks perfect on the product detail page with the code, but throws off the error. Without the code it works fine for "add to cart", but doesn't look right as it has the images and the links are live.

Offline

 

#38 01-21-2011 18:24:49

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Update cart quantity from product display.

At this point I can only think that the edit for the link/name is causing the product id to not be sent to the cart script.

John

Offline

 

#39 01-21-2011 18:38:15

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Update cart quantity from product display.

What version of ccp6 are you running? I have been looking at this and noticed that your prodmulti script is not quite the same as the one I have for ccp6 or ccp7, there basically different in this section (that I have noticed so far)

part of my ccp6 code for $add_ok section

Code:

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

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

      if ($add_ok) {

           print '<td class="' . $tdclass . '">' . $eol . $eol;
           print '<label for="' . $formid . '--' . $prodid . '--quantity';
           print '" class="hidden">Quantity</label>' . $eol;
           print '<input class="khxc_formfield" type="text" name="';
           print $formid . '--' . $prodid . '--quantity';
           print '" id="' . $formid . '--' . $prodid . '--quantity';
           print '" value="' . $quandisp . '" size="5" maxlength="5" />' . $eol;
           print '</td>' . $eol . $eol;

      } else {

           print '<td class="' . $tdclass . '">&nbsp;' . $eol . $eol;
           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;
           print '</td>' . $eol . $eol;

      } // End of if statement.

yours does not contain the quandisp variable.

John

Offline

 

#40 01-21-2011 18:38:57

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

I compared the old code in CCP_Prod.php with the new code that was giving that debug undefined var. This code was missing:

Code:

$usergroup = $this->globals('khxc_user.usergroup');

That isn't causing the error in the shopping cart, though. Still getting that.

Offline

 

#41 01-21-2011 19:10:31

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

dh783 wrote:

What version of ccp6 are you running? I have been looking at this and noticed that your prodmulti script is not quite the same as the one I have for ccp6 or ccp7, there basically different in this section (that I have noticed so far)
John

It looks like I have some code that is version 6.0.1, 6.0.2 and the khxc 6.6.2

This is what is says in the home page of the admin:

Kryptronic Hybrid X Core (KHXC 6.6.2)

ClickCartPro (CCP 6.0.4)

CCP_Prod.php say:
Package Version:   6.0.2
Package Date:      May 21, 2007

Last edited by JGB (01-21-2011 19:19:18)

Offline

 

#42 01-21-2011 19:24:07

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Update cart quantity from product display.

Not all code script will have updates so the chance you have code versions in this fashion are common, I have checked my old ccp6 version and the CCP file is at 6.0.9 and the KHXC file is at 6.6.8 so it does look like you have an older version of ccp6 running.

John

Offline

 

#43 01-21-2011 19:27:31

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

Looks like I need $app . '--prodaddtocart--quantity--' to be in there as well. When I switch out that code you posted I lose the numbers in the quantity boxes. However, I don't get the error anymore with that code, but I also don't get any product added...

Offline

 

#44 01-21-2011 20:01:40

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Update cart quantity from product display.

There where other changes like in the formid of multi add which changed so I not sure that the code I am running or gave you will work in the older ccp6 code.

John

Offline

 

#45 01-21-2011 22:16:49

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

Yeah, we didn't do some of the updates for fear of messing up the modifications that we did. Will running those updates, if they're still available, mess things up?

Offline

 

#46 01-22-2011 01:36:33

JGB
Member
From: Holyoke, Massachusetts
Registered: 01-16-2004
Posts: 298

Re: Update cart quantity from product display.

I got the cart working with no error messages and it looks the way I want it now. I made some changes to the code in prodmulti.php.

Code:

  $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'];

      $add_ok = 1;

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

      if ($add_ok) {

           print '<td class="' . $tdclass . '">' . $eol . $eol;
           print '<label for="' . $app . '--prodaddtocart--quantity--' . $num;
           print '" class="hidden">Quantity</label>' . $eol;
           print '<input class="khxc_formfield" type="text" name="';
           print $app . '--prodaddtocart--quantity--' . $num;
           print '" id="' . $app . '--prodaddtocart--quantity--' . $num;
           print '" value="0" size="5" maxlength="5" />' . $eol;
           print '</td>' . $eol . $eol;

      } else {

           print '<td class="' . $tdclass . '">&nbsp;</td>' . $eol . $eol;

           print '<label for="' . $app . '--prodaddtocart--quantity--' . $num;
           print '" class="hidden">Quantity</label>' . $eol;
           print '<p class="hidden"><input type="hidden" name="';
           print $app . '--prodaddtocart--quantity--' . $num;
           print '" id="' . $app . '--prodaddtocart--quantity--' . $num;
           print '" value="0" /></p>' . $eol;

      } // End of if statement.

      $image_ok = 0;

// +---
// | Edit added  prodview=N to if statememnt.
// +---

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

      if ($image_ok) {

           $imgurl   = 'media/' . $app . '/prodsm/' . $imgname;
           $imgtag   = '<a href="' . $prodlink . '" title="' . $prodname . '">';
           $imgtag  .= '<img src="' . $imgurl . '" ';
           if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
           $imgtag  .= 'alt="' . $prodname . '" /></a>';

           print '<td class="' . $tdclass . '">' . $imgtag . '</td>' . $eol . $eol;

      } else {

          if ($multi_images) {

               print '<td class="' . $tdclass . '">&nbsp;</td>' . $eol . $eol;

          } // End of if statement.

      } // End of if statement.

      print '<td class="' . $tdclass . '">';
      print '<p class="hidden"><input type="hidden" id="' . $app . '--prodaddtocart--ref--';
      print $num . '" name="' . $app . '--prodaddtocart--ref--' . $num . '" value="';
      print $prodid . '" /></p>' . $eol;
      print '<p>' . $prodname . '</p>' . $eol;

     // if (!(empty($proddesc))) {print '<p>' . $proddesc . '</p>' . $eol;}

      $this->globals('ecom.prod_proddisp',$prod);
      $this->globals('ecom.prod_priceinfo',$prod['khxc.priceinfo']);

2 problems, though:

1. If I don't select any items and leave them all set to 0, I don't get an error message saying that no products were selected when I click add to cart. I was looking in CCP_Cart.php to see if that was where I needed to fix that issue. Still looking... Is this the right place to be looking?

2. The products show up nicely in the , the only problem is that again the name, ID and size are an active link. I'm trying to figure out where to deactivate that link so it's like it looks on the   page. Is this also in CCP_Cart.php?

Offline

 

Board footer