Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CB9TOIIIA/b3fb55d4acc0c1cc6a015aafa7db5ca2 to your computer and use it in GitHub Desktop.
Save CB9TOIIIA/b3fb55d4acc0c1cc6a015aafa7db5ca2 to your computer and use it in GitHub Desktop.
Последние заказы и массив по условию JBZoo
$LastOrders = JBModelOrder::model()->getList();
$allitem = array();
foreach ($LastOrders as $Order) {
$order = JBModelOrder::model()->getById($Order->id);
$cartItems = $order->getItems(false);
foreach ($cartItems as $cartItem) {
if ($order->getPaymentStatus()->getName() == 'Оплачен') {
if ($cartItem->item_name == $item->name) {
$allitem[] = $cartItem->item_name;
}
}
}
}
if (NULL != $allitem) {
echo count($allitem) . ' шт. купонов уже купили';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment