快疯了,3天了,无法在批发里加上单位(箱、吨)

2016-07-07 15:14 来源:www.chinab4c.com 作者:ecshop专家



在数据库goods表下,建了一个goods_unit

打开includes/lib_goods.php

修改一下部分
  1. function wholesale_info($act_id)
  2. {
  3. $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('wholesale') .
  4. " WHERE act_id = '$act_id'";
  5. $row = $GLOBALS['db']->getRow($sql);
  6. /****这里加上一句*****/
  7. $sql="select goods_unit from ".$GLOBALS['ecs']->table('goods').
  8. " WHERE goods_id = '$goods_id'";
  9. $goods_unit=$GLOBALS['db']->getOne($sql);
  10. $row['goods_unit']=$goods_unit;
  11. /******到这里结束*****/
  12. if (!empty($row))
  13. {
  14. $row['price_list'] = unserialize($row['prices']);
  15. }

  16. return $row;
  17. }
复制代码
在批发页面wholesale_list.dwt调用 {$goods.goods_unit}

不显示任何东西!!!

回答:
还是代码不太对啊。

你可以调用分类所属的单位把



一开始就是调用的分类单位,不管用才用的这种方法

  1. index.php:


  2. $smarty = new Smarty;
  3. $smarty->assign('firstname', 'Doug');
  4. $smarty->assign('lastLoginDate', 'January 11th, 2001');
  5. $smarty->display('index.tpl');

  6. index.tpl:

  7. Hello {$firstname}, glad to see you could make it.
  8. <p>
  9. Your last login was on {$lastLoginDate}.

  10. OUTPUT:

  11. Hello Doug, glad to see you could make it.
  12. <p>
  13. Your last login was on January 11th, 2001.
复制代码
先要读懂smarty ,才会改程序啊