When a subproduct (using exsubproduct_live) is added to the basket, a new product node gets generated that creates a mashed title of the product and its variant attributes.

In the view_cart theme, it would be great to be able to split these apart. So there is the parent product name/link, and then a list of its attributes.

$form['items'][$nid]['title']['#value'] is a link to the parent product - but contains the mashed name. A new array of each attribute would be ideal -- rather than just mashing the name together.

Basically, feature request is to keep the parent product title, and the attributes separate - and modify the view_cart theme to support showing variants in a nice list.

I'm writing a bunch of string parsing routines at the theme level to end-run this at the moment.

CommentFileSizeAuthor
#2 cart_view_form.tpl_.php_.txt2.19 KBAnonymous (not verified)

Comments

brmassa’s picture

Project: e-Commerce » eC Live Subproducts
Version: 5.x-3.0 » 5.x-2.07
Component: subproducts » Code
Assigned: Unassigned » brmassa
Status: Active » Postponed

Greg,

Lets go:
1* Thanks for reporting a bug. you are welcome to do so.
2* EC Live will be merged on Ecommerce v4 only. while on v3, will should post errors on EC Live Subproducts module.
3* The cart view is a Ecommerce module problem. But since i like your idea and im working on v4, im going to work on this for v4.
4* If you want to maintain (for now) only the parent products name on every combination, there is a trick:
4a* Enter parent product SKU the same as its title.
4b DONT enter any SKU on each attribute.
4c Select "Use SKU as title" on parent product attributes page.
5* Im gonna check every code you send.

regards,

massa

Anonymous’s picture

StatusFileSize
new2.19 KB

Cool trick - thank you. I actually need SKU info though for subproducts for the fulfillment guys.

I ended up overwriting cart_view_form.tpl.php from ecommerce, and then parsed up the title in there just at the theme level. Also did a node_load to get at the parent product info... all extra steps. Attached is that override -- seems like at some point titles are merged - but really it would be great if they were coming through as parent product, with an array of variants or something like that. And then could style them as needed.

Thanks for working on it for V4!
-Greg

brmassa’s picture

Status: Postponed » Fixed

Greg,

Based on your patch, im going to fix cart.module on ECommerce v4.
Here is the code that im going to include (marked with a plus):

function theme_cart_view_form($form) {
  $total = 0;
  $header = array(t('Items'), t('Qty.'), '');
  $extra = array_filter($form['items'], '_cart_form_filter_extra');
  if ($extra) {
    $header[] = '';
  }

  foreach (element_children($form['items']) as $nid) {
    $total+= $form['items'][$nid]['#total'];
    $total+= $form['items'][$nid]['#specials'];
    $desc = drupal_render($form['items'][$nid]['title']) .'<br />';
+    if (!empty($form['items'][$nid]['#node']->subproduct_attributes)) {
+      $desc .= "<p>";
+      foreach ($form['items'][$nid]['#node']->subproduct_attributes as $attribute) {
+        $desc .= "<b>". $attribute["name"] ."</b>: <em>". $attribute["title"] ."</em><br />";
+      }
+      $desc .= "</p>";
+    }

regards,

massa

brmassa’s picture

Status: Fixed » Closed (fixed)