Download & Extend

Stock level for views filters of translated products

Project:Ubercart
Version:6.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)
Issue tags:ubercart i18n

Issue Summary

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

Comments

#1

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"

#2

Status:needs work» closed (duplicate)

This is a fundamental problem with the current stock table, and #1092322: Primary key on uc_product_stock is wrong has much more detail about what could be done here.

nobody click here