Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / display product attributes on checkout payment page

display product attributes on checkout payment page

Views: 3,967

Results 1 to 20 of 40
22 Sep 2011, 10:24 PM
#1
bigtheory avatar

bigtheory

New Zenner

Join Date:
Jun 2010
Posts:
2
Plugin Contributions:
0

display product attributes on checkout payment page

I would really appreciate if anyone can help here. i have a product that is going to be billed monthly if a customer opts in. There is an attribute setup on the product info page as a checkbox that says "ship this product monthly?" If the customer checks this box, the attribute is output to the shopping cart page below the product image. (ship this product monthly? Yes)

I need to have this attribute displayed on the cart payment page. I have gone into the shopping cart page to try and snag the php that appears to call the attribute to see if i could just place it on the payment page. no luck. :blink:

16 Feb 2012, 6:20 PM
#2
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

I found this old thread from 2006.

I do not know if it still works for ver.1.3.9, I too would love to have this work on my checkout page only as well.

Could someone please look at this with zencart experience and let us know if this would work in ver 1.3.9

includes/module/pages/shopping_cart/header_php.php <<<<<<<<<<<<<<
line 93 for me:
change

Code:
$attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefixto

Code:
$attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.attributes_imageline 123 for me:
after

Code:
$attrArray[$option]['price_prefix'] = $attributes_values->fields['price_prefix'];Add:

Code:
$attrArray[$option]['attributes_image'] = $attributes_values->fields['attributes_image'];

templates/template_default/templates/tpl_shopping_cart_default.php <<<<<<<<<<<<<<

change line 85 from (line 85 for me)

Code:
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>to

Code:
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>
line 89 for me:
before:

Code:
echo $product['attributeHiddenField'];ADD:

Code:
if (isset($product['attributes']) && is_array($product['attributes'])) {
echo '';

}else {
?><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><?PHP
}
line 101 for me:
directly after

Code:
foreach ($product['attributes'] as $option => $value) {add

Code:
echo zen_image(DIR_WS_IMAGES . $value['attributes_image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);

16 Feb 2012, 6:35 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: display product attributes on checkout payment page

You could try this code on the tpl_checkout_payment_default.php from the checkout_confirmation:

      <table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay">
        <tr class="cartTableHeading">
        <th scope="col" id="ccQuantityHeading" width="30"><?php echo TABLE_HEADING_QUANTITY; ?></th>
        <th scope="col" id="ccProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<?php
  // If there are tax groups, display the tax columns for price breakdown
  if (sizeof($order->info['tax_groups']) > 1) {
?>
          <th scope="col" id="ccTaxHeading"><?php echo HEADING_TAX; ?></th>
<?php
  }
?>
          <th scope="col" id="ccTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th>
        </tr>
<?php // now loop thru all products to display quantity and price ?>
<?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { ?>
        <tr class="<?php echo $order->products[$i]['rowClass']; ?>">
          <td  class="cartQuantity"><?php echo $order->products[$i]['qty']; ?> x</td>
          <td class="cartProductDisplay"><?php echo $order->products[$i]['name']; ?>
          <?php  echo $stock_check[$i]; ?>

<?php // if there are attributes, loop thru them and display one per line
    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0 ) {
    echo '<ul class="cartAttribsList">';
      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
?>
      <li><?php echo $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); ?></li>
<?php
      } // end loop
      echo '</ul>';
    } // endif attribute-info
?>
        </td>

<?php // display tax info if exists ?>
<?php if (sizeof($order->info['tax_groups']) > 1)  { ?>
        <td class="cartTotalDisplay">
          <?php echo zen_display_tax_value($order->products[$i]['tax']); ?>%</td>
<?php    }  // endif tax info display  ?>
        <td class="cartTotalDisplay">
          <?php echo $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']);
          if ($order->products[$i]['onetime_charges'] != 0 ) echo '<br /> ' . $currencies->display_price($order->products[$i]['onetime_charges'], $order->products[$i]['tax'], 1);
?>
        </td>
      </tr>
<?php  }  // end for loopthru all products ?>
      </table>
      <hr />

place it above the line:

<fieldset id="checkoutOrderTotals">

and see if that is what you are looking for ...

16 Feb 2012, 7:49 PM
#4
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

I tried the code but it still shows the tanktop in the defalt image and white, instead of the black when I choose that attribute.

this is my test site if you would like to see it.

http://www.sinecurewine.com/catalog/index.php

I am working with the relaxed tank, and I have rollover images working in the product type, from one of the mods. Do you think this could be the issue?

16 Feb 2012, 7:58 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: display product attributes on checkout payment page

You need to fix your site ... some links use the /catalog some use /cgi/store ...

When using the cart for /catalog and actually getting to the /catalog checkout I seem to have the right attributes on the checkout_payment ...

16 Feb 2012, 8:12 PM
#6
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

Yes, I am sorry I should have been more clear, I am getting ready to push the test shopping site up to the full site so some links on the above sections go to the live site. I am moving away from CGI to zencart, but I need to have it all working first.

I am a little confused when you say you see "catalog and actually getting to the /catalog checkout"

When I am at this stage of the purchase
"http://www.sinecurewine.com/catalog/index.php?main_page=shopping_cart&number_of_uploads=0"

I see a white thumb nail of the garment and not the black. I would like to see a black one when I choose that attribute, I am sorry for not been clear.

16 Feb 2012, 8:45 PM
#7
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

I think I may have messed everything up in regards to what I am attempting.

After a person selects a garment with the option of black, I would like for them to see the thumb nail of the garment in black in their shopping cart. which is one of my rollover thumb nails from the product page.

I have this code from a closed thread in 2008, but I do not know if it is still valid with 1.3.9

First open: includes > modules > pages > shopping_cart > header_php.php

Look around line 93 for this:

Code:
$attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefixand add: pa.attributes_image to the list

Next, scan a little further down (around line 117) for this:

Code:
$attrArray[$option]['products_options_name'] = $attributes_values->fields['products_options_name'];
$attrArray[$option]['options_values_id'] = $value;
$attrArray[$option]['products_options_values_name'] = zen_output_string_protected($attr_value) ;
$attrArray[$option]['options_values_price'] = $attributes_values->fields['options_values_price'];
$attrArray[$option]['price_prefix'] = $attributes_values->fields['price_prefix'];and add:
$attrArray[$option]['attributes_image'] = $attributes_values->fields['attributes_image'];

Save and upload this file.

Now find: includes > templates > YOUR_TEMPLATE_NAME > templates > tpl_shopping_cart_default.php

Look around line 98:

Code:

<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li>and change to the following: <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . zen_image(DIR_WS_IMAGES . $value['attributes_image']); ?></li>

Any suggestion would greatly be appreciated, and I can promise coffee on the way.

16 Feb 2012, 10:26 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: display product attributes on checkout payment page

Your code works fine, but you are using an add on to manage the displayed attribute images if I am not mistaken ...

Look in the Admin at the Product in the Attributes Controller ...

What is the actual image on the Black Attribute?

16 Feb 2012, 11:58 PM
#9
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

Yes, I am.

It sounds like I need to better understand the attributes mod. What I am glening from your comments is that there is a way to select the black thumb nail with the attribute. I will have to find some text to better understand, sorry.
:blush:

17 Feb 2012, 12:01 AM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: display product attributes on checkout payment page

Check the black attribute ... is the black image on that?

If not, are you able to add the black image to the black attribute or does that cause a problem?

17 Feb 2012, 2:44 AM
#11
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

I added the black image to the attribute, but it added the image to the product page below the dropdown box for the attribute selection. When I went to the shopping cart it still showed the defalt white image.

17 Feb 2012, 2:55 AM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: display product attributes on checkout payment page

If you need the attribute image for the shopping cart but not for the display on the product_info ... add to your stylesheet:

.attribImg {
  display: none;
}

Now the images will not show ...

NOTE: make sure you do not use that class for anywhere that you do want to see them ...

17 Feb 2012, 3:06 AM
#13
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

Ok, I can add the snipet of code, but I still do not get the black image to show on the shopping cart verses the white image.

No matter what I am telling the attribute to be (in this case Black) when I go to the shopping cart it still displays the original white thumb nail.

I am hoping that when I select the black atribute on the product page and click next, the shopping cart will display the new thumb nail in the black not the white.

If you go to my site:
http://www.sinecurewine.com/catalog/index.php

And select the The Pump&Nurse Relaxed Support Tank, then at the product page select black, then click add to bag, the next screen shows a white thumb nail next to the black attribute text.

I hope I do not upset you by my step by step, but I just want to be clear in what I am trying to do.

17 Feb 2012, 3:14 AM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: display product attributes on checkout payment page

What image is on the black attribute in the Attributes Controller?

17 Feb 2012, 3:17 AM
#15
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

the black one

17 Feb 2012, 3:21 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: display product attributes on checkout payment page

I am not sure what to tell you then ... your code works fine for me I pick red I get red I pick orange I get orange ... I get whatever is on the attributes image ...

17 Feb 2012, 3:24 AM
#17
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

Well, I really do thank you for trying. I wish I had the answer but in that case do you think there is a way to hide the image all together from the shopping cart. That is my last resort.

17 Feb 2012, 3:26 AM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: display product attributes on checkout payment page

You are displaying it with:

<span id="cartImage" class="back">
<img width="30" height="40" title=" The Pump&Nurse Relaxed Support Tank " alt="The Pump&Nurse Relaxed Support Tank" src="images/swap_main.jpg">
</span>

you might first try to find how that code is made to see if it is conflicting with what you are trying to do ...

17 Feb 2012, 3:32 AM
#19
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

I will look into it first thing in the morning, I have to put the baby to bed soon.

Just as an FYI I am using a MOD in the product page that allows for the rollover effect, but I do not think that is the issue, unless you do.

17 Feb 2012, 7:51 PM
#20
gokeypa avatar

gokeypa

New Zenner

Join Date:
Sep 2011
Posts:
86
Plugin Contributions:
0

Re: display product attributes on checkout payment page

It seam that the issue should be here somewhere but i am not 100% sure.

Line #84 : <a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

From: tpl_shopping_cart_default.php