我想给购物车对象一个新的ID,我有以下代码:
SELECT DISTINCT --Does this need to be here?
h.id,
h.status,
a.billing_state,
d.queue_desc,
r.role_desc,
DATEDIFF(DAY, recd_dt, GETDATE() + 1) AS AGE,
h.drag_dt
FROM dbo.tbl_1 h
JOIN dbo.prov p ON h.id = p.id
JOIN dbo.address a ON p.id = a.id
LEFT JOIN dbo.queue_msg m ON h.id = m.msg_id
LEFT JOIN dbo.queue_def d ON m.queue_id = d.queue_id
LEFT JOIN dbo.roles r ON m.role_id = r.role_id
JOIN dbo.me_msg w ON h.ck = w.ck
WHERE h.ck = '123'
AND a.type = 'PRI'
AND w.seq_no = '00000'
AND (((h.drag_dt BETWEEN '9999-01-01 00:00:00.000' AND '9999-12-31 00:00:00.000'
OR h.drag_dt BETWEEN '3334-01-01 00:00:00.000' AND '3334-12-31 00:00:00.000')
AND h.status = '04')
OR (NOT (h.drag_dt BETWEEN '9999-01-01 00:00:00.000' AND '9999-12-31 00:00:00.000'
OR h.drag_dt BETWEEN '3334-01-01 00:00:00.000' AND '3334-12-31 00:00:00.000')
AND h.status IN ('01', '02', '03')))
ORDER BY h.drag_dt DESC;
未“替换”购物车,我尝试了几件事:使用$ GLOBALS全局关键字,但是没有什么能真正替换或更改购物车对象。最好的方法是什么?
答案 0 :(得分:1)
尝试:
if ($payment->order_result->return->failures->failure == 'field.ordernumber.exists') {
$context = Context::getContext();
$cart_products = $context->cart->getProducts();
$this->context->cart->delete();
$newCart = new Cart();
if (!$context->cart->id) {
$guest = new Guest();
$context->cart->mobile_theme = $guest->mobile_theme;
$context->cart->add();
if ($context->cart->id)
$context->cookie->id_cart = (int)$context->cart->id;
}
foreach ($cart_products as $product) {
Db::getInstance()->insert('cart_product', array(
'id_product' => (int)$product->id,
'id_product_attribute' => (int)0,
'id_cart' => (int)$newCart->id,
'quantity' => (int)$product->quantity,
'date_add' => date('Y-m-d H:i:s')
));
}
}
答案 1 :(得分:0)
受@ethercreation答案的启发,我更改了以下内容以解决我的问题:
发件人
import numpy as np
import cv2
from matplotlib import pyplot as plt
img1 = cv2.imread('template.jpg',0) # queryImage
img2 = cv2.imread('input.jpg',0) # trainImage
sift=cv2.xfeatures2d.SIFT_create()
kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)
# BFMatcher with default params
bf = cv2.BFMatcher()
matches = bf.knnMatch(des1,des2, k=2)
# Apply ratio test
good = []
for m,n in matches:
if m.distance < 0.75*n.distance:
good.append([m])
# cv2.drawMatchesKnn expects list of lists as matches.
img3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,good,None,flags=2)
收件人
$dup = $this->context->cart->duplicate();
$this->context->cart->delete();
$this->context->cart = new Cart($dup['cart']->id);
必不可少的部分是$dup = $this->context->cart->duplicate();
$this->context->cart->delete();
$this->context->cookie->id_cart = $dup['cart']->id;
无法更改。需要复制购物车,然后更改cookie中的当前购物车。因此,应将Cookie $this->context->cart
更改为新创建的购物车的$this->context->cookie->id_cart
!