/**
* @param $class
* @return mixed
*/ public function mc_get_obj($class)
{
return \Magento\Framework\App\ObjectManager::getInstance()->get($class);
} /**
* TODO UPDATE
* @return bool|mixed
*/
public function update()
{
$customerId = $this->customerId; //fixme redirect login
if (!$customerId) {
//Todo @return not login
$this->_die('not login', [], '/customer/account/login');
} //fixme get request
$req = $this->setReq()->req; $o = $this->_o;
$data = $req[$o];
/**
* @var $quoteItem \Magento\Quote\Model\Quote\item
*/
$quoteItem = $this->mc_get_obj('Magento\Quote\Model\Quote\item');
//req item id
$item_id = $req[$o]['item_id'];
//GET Quote id
$item = $quoteItem->load($item_id);
//GET Quote id
$quoteId = $item->getQuoteId(); try {
/**
* @var $quote \Magento\Quote\Model\Quote
*/
$quote = $this->mc_get_obj(\Magento\Quote\Model\Quote::class)->load($quoteId);
$item = $quote->getItemById($item_id);
if (!$item) {
var_dump('Item is empty !');
die;
}
$item->setSizeId($data['size_id']);
$item->setSizeType($data['size_type']);
$result = $item->save()->toArray();
$this->_die('Success !', [
'size_id'=>$result['size_id'],
'size_type'=>$result['size_type'],
], '', 1);
} catch (\Exception $e) {
$this->_die($e->getMessage());
}
}

最新文章

  1. dma_ops
  2. MVC 单元测试
  3. 关于提高python程序执行效率的思路和想法
  4. PHP mysqli 扩展库(面向对象/数据库操作封装/事务控制/预编译)
  5. To Use Ubuntuubunt
  6. 我的第一个python爬虫程序
  7. Play - js/css concatenation & minify
  8. Selenium关于Page Objects
  9. css挖坑爬坑之div高宽相等
  10. studio中碰到的jni问题:java.lang.UnsatisfiedLinkError
  11. 7.首页、bitmaputils
  12. web应用 与 http协议
  13. SQLITE在IIS中使用问题
  14. IDAPython安装
  15. 2018-2019 2 20165203 《网络对抗技术》Exp5 MSF基础
  16. 【转载】Qt中图像的显示与基本操作
  17. Course List for Student
  18. Convolutional Networks for Images,Speech,and Time-series
  19. 一个exception
  20. Java -- 新IO -- 目录

热门文章

  1. 函数调用约定_stdcall[转]
  2. ELK同步kafka带有key的Message
  3. pytorch之 compare with numpy
  4. Kafka运维大全来了!优化、监控、故障处理……
  5. Zookeeper 应用实例
  6. Arm开发板+Qt学习之路-开发板显示 /bin/sh: ./hello: Permission denied
  7. js—DOM详情
  8. JAVA架构之单点登录 任务调度 权限管理 性能优化大型项目实战
  9. SAP 如何看某个TR是否传入了Q或者P系统?
  10. 【POJ - 2533】Longest Ordered Subsequence (最长上升子序列 简单dp)