Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $productsT = TableRegistry::get('Products');
  2. $allProducts = $productsT->find('all')->contain(['ProductCategories'])->order(['Products.name' => 'ASC', 'Products.vessel' => 'DESC']);
  3.  
  4.  
  5. And in template where I foreach this was like this
  6. $PricesT = TableRegistry::get('Prices');
  7. if(isset($this->request->data['groups']) && !isset($_SESSION['group_id'])){
  8. $imported = $PricesT
  9. ->find('all')
  10. ->where(['Prices.product_id' => $product->id, 'Prices.group_id' => $this->request->data['groups']])
  11. ->andWhere(['Prices.csv_file_name' != null, 'Prices.valid_to >' => time()])
  12. ->order(['Prices.created' => 'DESC'])
  13. ->first();
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement