BFH Handwriting Downloads: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:
== Verifying download count ==
== Verifying download count ==
<syntaxhighlight lang="mysql">
<syntaxhighlight lang="mysql">
SELECT @order_id := [ORDER_ID];
select p.catno,
select p.catno,
p.name,
p.name,
Line 12: Line 14:
inner join cart_order o on i.order_id = o.id
inner join cart_order o on i.order_id = o.id
inner join address b on o.billing_id = b.id
inner join address b on o.billing_id = b.id
where i.order_id = [ORDER_ID];
where i.order_id = @order_id;
</syntaxhighlight>
</syntaxhighlight>


== Reseting download count ==
== Reseting download count ==
<syntaxhighlight lang="mysql">
<syntaxhighlight lang="mysql">
update order_item_link set download_count = 0 where order_id = [ORDER_ID] and product_id = [PRODUCT_ID];
SELECT @order_id := [ORDER_ID];
SELECT @product_id := [PRODUCT_ID];
 
update order_item_link set download_count = 0 where order_id = @order_id and product_id = @product_id;
</syntaxhighlight>
</syntaxhighlight>

Revision as of 22:21, 4 January 2017

Verifying download count

SELECT @order_id := [ORDER_ID];

select p.catno,
p.name,
i.download_token,
i.download_count,
CONCAT(IFNULL(CONCAT(b.first_name, ' '), ''), IFNULL(b.last_name, '')) as customer,
i.product_id
from order_item_link i 
inner join catalog_item p on i.product_id = p.id
inner join cart_order o on i.order_id = o.id
inner join address b on o.billing_id = b.id
where i.order_id = @order_id;

Reseting download count

SELECT @order_id := [ORDER_ID];
SELECT @product_id := [PRODUCT_ID];

update order_item_link set download_count = 0 where order_id = @order_id and product_id = @product_id;