Stock level for views filters of translated products

GiorgosK - October 29, 2009 - 16:38
Project:Ubercart
Version:6.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:ubercart i18n
Description

in ubercart/uc_stock/views/uc_stock.views.inc

we have

function uc_stock_views_data() {
  $data['uc_product_stock']['table']['group'] = t('Stock');

  $data['uc_product_stock']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );
...

If we changed

      'left_field' => 'tnid',

the join will happen using the translation nid and will help in exposing the stock level filter of translated nodes/products to views

This is necessary since the {uc_product_stock} table has SKU as the primary key
and translated products can't get their own entry in the stock table
and thus the views can't find the stock levels for translated products

#1

GiorgosK - November 20, 2009 - 15:53
Status:active» needs work

Still the above workaround does not come without problems when it comes to multilanguage sites (or single language sites)
the "tnid" is not set when a node does not have ANY translation

additional steps have to be taken to make sure that a node always has a "tnid"

 
 

Drupal is a registered trademark of Dries Buytaert.