Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $productsT = TableRegistry::get('Products');
- $allProducts = $productsT->find('all')->contain(['ProductCategories'])->order(['Products.name' => 'ASC', 'Products.vessel' => 'DESC']);
- And in template where I foreach this was like this
- $PricesT = TableRegistry::get('Prices');
- if(isset($this->request->data['groups']) && !isset($_SESSION['group_id'])){
- $imported = $PricesT
- ->find('all')
- ->where(['Prices.product_id' => $product->id, 'Prices.group_id' => $this->request->data['groups']])
- ->andWhere(['Prices.csv_file_name' != null, 'Prices.valid_to >' => time()])
- ->order(['Prices.created' => 'DESC'])
- ->first();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement