Jump to content

PRODUCT TITLE in viewOrders page


Syler

Recommended Posts

Hi Guys,

Can anyone help with this..

I need to show the product title in the viewOrders page.

So when the customer login to their order history,

they can see right away all the products that they previously ordered without have to click the 'VIEW' link (Action) one by one.

Any helps or suggestions would be greatly appreciated.

Thank you!

Link to comment
Share on other sites

Backup the following two files before making any changes.

Well, to start with, we need to add a new statement and modify the database query to the \includes\content\viewOrders.inc.php file, and add a new table column to the \skins\Your_Skin\styleTemplates\content\viewOrders.tpl file.

The database query just grabs a few fields from each record from the order_sum table that pertain to the customer's ID number. None of these fields are the product's name - and the product name is not stored in this table anyway.

So, we need to join the table that has the Product name into the query and pull only relevant records. So, at about line 42, change:

"SELECT status, cart_order_id, time

FROM ".$glob['dbprefix']."CubeCart_order_sum

WHERE customer_id = ".$db->mySQLsafe($ccUserData[0]['customer_id'])."

ORDER BY `time` DESC"

to:

"SELECT status, os.cart_order_id, oi.name, time

FROM ".$glob['dbprefix']."CubeCart_order_sum os

LEFT JOIN ".$glob['dbprefix']."CubeCart_order_inv oi

ON os.cart_order_id = oi.cart_order_id

WHERE customer_id = ".$db->mySQLsafe($ccUserData[0]['customer_id'])."

ORDER BY `time` DESC"

Now that we have the product's name, we need to feed it into a viewOrders placeholder. After the line:

$view_orders->assign("LANG_ORDER_NO"...

add this line:

$view_orders->assign("LANG_PRODUCT_NAME","Product Name");

You would think we would need to do something at about line 60, but we don't.

In viewOrders.tpl, we need to add a new column to hold the product name. For the column heading, after the line:

<td class="tdcartTitle">{LANG_ORDER_NO}</td>

add this line:

<td class="tdcartTitle">{LANG_PRODUCT_NAME}</td>

For the column data, after the line:

<td class="{TD_CART_CLASS}"><a href...

add this line:

<td class="{TD_CART_CLASS}">{DATA.name}</td>

Save your changes and see what happens. (I have not done this myself.)

Link to comment
Share on other sites

  • 1 year later...

Backup the following two files before making any changes.

Well, to start with, we need to add a new statement and modify the database query to the \includes\content\viewOrders.inc.php file, and add a new table column to the \skins\Your_Skin\styleTemplates\content\viewOrders.tpl file.

The database query just grabs a few fields from each record from the order_sum table that pertain to the customer's ID number. None of these fields are the product's name - and the product name is not stored in this table anyway.

So, we need to join the table that has the Product name into the query and pull only relevant records. So, at about line 42, change:

"SELECT status, cart_order_id, time

FROM ".$glob['dbprefix']."CubeCart_order_sum

WHERE customer_id = ".$db->mySQLsafe($ccUserData[0]['customer_id'])."

ORDER BY `time` DESC"

to:

"SELECT status, os.cart_order_id, oi.name, time

FROM ".$glob['dbprefix']."CubeCart_order_sum os

LEFT JOIN ".$glob['dbprefix']."CubeCart_order_inv oi

ON os.cart_order_id = oi.cart_order_id,

WHERE customer_id = ".$db->mySQLsafe($ccUserData[0]['customer_id'])."

ORDER BY `time` DESC"

Now that we have the product's name, we need to feed it into a viewOrders placeholder. After the line:

$view_orders->assign("LANG_ORDER_NO"...

add this line:

$view_orders->assign("LANG_PRODUCT_NAME","Product Name");

You would think we would need to do something at about line 60, but we don't.

In viewOrders.tpl, we need to add a new column to hold the product name. For the column heading, after the line:

<td class="tdcartTitle">{LANG_ORDER_NO}</td>

add this line:

<td class="tdcartTitle">{LANG_PRODUCT_NAME}</td>

For the column data, after the line:

<td class="{TD_CART_CLASS}"><a href...

add this line:

<td class="{TD_CART_CLASS}">{DATA.name}</td>

Save your changes and see what happens. (I have not done this myself.)

It does not work for me. I get a SQL error. Any advise?

Link to comment
Share on other sites

Yes. My advice is to always report what the error is. It helps to have double-checked the changes suggested to determine if you missed changing anything and to report that the changes have been made according to the instructions. Also please mention if you have any other modifications installed, and the exact version of CC and MySQL you are using.

Link to comment
Share on other sites

Thanks! I will supply the information below:

CC version: 3.0.20

MySQl: 5.0.67

PHP: 5.2.12

Apache/2.2.14 (Unix)

Error message:

MySQL Error Occured

1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE customer_id = '1' ORDER BY `time` DESC' at line 5

QUERY = SELECT status, os.cart_order_id, oi.name, time FROM storeCubeCart_order_sum os LEFT JOIN storeCubeCart_order_inv oi ON os.cart_order_id = oi.cart_order_id, WHERE customer_id = '1' ORDER BY `time` DESC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...