If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / add model number in checkout and conformation page?

add model number in checkout and conformation page?

Started by aatony on 30 Jan 2015, 3:13 PM · Views: 1,521

Results 1 to 6 of 6
30 Jan 2015, 3:13 PM
#1
aatony avatar

aatony

New Zenner

Join Date:
Jan 2015
Location:
United States
Posts:
3
Plugin Contributions:
0

Post #1 by aatony

how to add model number in checkout and conformation page,,i have spent hours researching this on the forum and google with no results, i took the code from main product page and placed it in the main check out page next to attributes , of coarse nothing happened ,, i have placed different parts of the code in different places in the main cart page with no results,, it seams like it would be a simple task , im missing something somewhere,, can someone help me get it to work?

30 Jan 2015, 3:26 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #2 by mc12345678

aatony:

how to add model number in checkout and conformation page,,i have spent hours researching this on the forum and google with no results, i took the code from main product page and placed it in the main check out page next to attributes , of coarse nothing happened ,, i have placed different parts of the code in different places in the main cart page with no results,, it seams like it would be a simple task , im missing something somewhere,, can someone help me get it to work?

Generally also need to look in the files loaded in the pages directory for the page you want the data. So for example, the shopping cart page you would look at includes/modules/pages/shopping_cart directory, and see header_php.php and I think a javascript file... Suggest looking at/editing the header_php.php file, though it may also be that you've turned off some option in the admin panel to hide that information from those pages.... Check the product type info under the catalog drop down, also the layout settings in the configuration dropdown, and the others there as well.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

30 Jan 2015, 3:48 PM
#3
ajeh avatar

ajeh

Oba-san

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

Post #3 by ajeh

You could customize the template file using your templates and overrides for:
/includes/templates/template_default/templates/tpl_checkout_confirmation_default.php

and copy it to:
/includes/templates/your_template_dir/templates/tpl_checkout_confirmation_default.php

and add the code in RED:

          <td class="cartProductDisplay"><?php echo $order->products[$i]['name'][B] . ' - ' . $order->products[$i]['model'][/B]; ?>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Jan 2015, 4:20 PM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Post #4 by rodg

aatony:

how to add model number in checkout and conformation page,

Adding this to the confirmation page is pretty straightforward.

Which other of the 'checkout' page(s) do you wish this to been seen. If it's the checkout success page then that is a little more difficult, but perhaps you are thinking of another page entirely?

aatony:

,i have spent hours researching this on the forum and google with no results, i took the code from main product page and placed it in the main check out page next to attributes , of coarse nothing happened ,, i have placed different parts of the code in different places in the main cart page with no results,, it seams like it would be a simple task , im missing something somewhere,, can someone help me get it to work?

OK, for the confirmation page.

The file to edit is /includes/templates/YOUR_TEMPLATE/templates/tpl.checkout _confirmation.php

Look for the code that reads like:

<?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]; ?>

Add a new line, so it reads:

<?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']; ?>
                    [B]<?php echo $order->products[$i]['model']; ?> [/B]     
          <?php  echo $stock_check[$i]; ?>

You may also wish to place this into its own <td class> for formatting purposes.
Save the file and you're done.

To have this displayed on the checkout success page (where by default they are shown only as part of the 'Please notify me of updates to these products' you need to either replicate this loop part of the code and add it to the checkout success page, OR, you could opt to just add the model number to the notification list.
To add it to the notification list you'll need to edit
/includes/modules/pages/account_notifications/header_php.php and modify the search query

$products_query = "SELECT pd.products_id, pd.products_name
                   FROM   " . TABLE_PRODUCTS_DESCRIPTION . " pd,
                          " . TABLE_PRODUCTS_NOTIFICATIONS . " pn
                   WHERE  pn.customers_id = :customersID
                   AND    pn.products_id = pd.products_id
                   AND    pd.language_id = :languagesID
                   ORDER BY pd.products_name";


$products_query = $db->bindVars($products_query, ':customersID',$_SESSION['customer_id'], 'integer');
$products_query = $db->bindVars($products_query, ':languagesID',$_SESSION['languages_id'], 'integer');
$products = $db->Execute($products_query);
while (!$products->EOF) {
  $notificationsArray[] = array('counter'=>$counter,
                                'products_id'=>$products->fields['products_id'],
                                'products_name'=>$products->fields['products_name']);
  $counter++;
  $products->MoveNext();
}

... so that it includes the model number. To do this though you'll need to add a 'join' to the query (or create another query) to retrieve the model number from the 'products' table and add this to the $notificationsArray[], either by concating it to one of the exiting fields, or by creating a new field and then making changes to the checkout_success page so that it outputs this additional data field. As I said, its not quite as easy as the change needed for the confirmation page.

Since I'm not sure that this is the actual page you are thinking of though I've left it up to you to fill in the exact detail. :)

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

30 Jan 2015, 5:28 PM
#5
aatony avatar

aatony

New Zenner

Join Date:
Jan 2015
Location:
United States
Posts:
3
Plugin Contributions:
0

Post #5 by aatony

ok Rodg,, dude your code worked on the conformation page, i could not have done that without you,,thanks alot,,, i have tried the code on the main checkout page but cant seam to get it to work,, the main checkout page for me is just as important as the conformation page, can you help me on that issue,,
my logic tells me that zen should include something like that in the main code by defalt,, model or SKU is important