Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

room type selection in cart rules #183

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions controllers/admin/AdminCartRulesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,21 @@ public function getProductRuleDisplay($product_rule_group_id, $product_rule_id,
case 'products':
$products = array('selected' => array(), 'unselected' => array());
$results = Db::getInstance()->executeS('
SELECT DISTINCT name, p.id_product as id
SELECT DISTINCT name, hbl.`hotel_name`, p.id_product as id
FROM '._DB_PREFIX_.'product p
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
ON (p.`id_product` = pl.`id_product`
AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
'.Shop::addSqlAssociation('product', 'p').'
WHERE id_lang = '.(int)Context::getContext()->language->id.'
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt
ON (p.`id_product` = hrt.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbl
ON (hrt.`id_hotel` = hbl.`id` AND hbl.`id_lang` = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
ORDER BY name');
foreach ($results as $row) {
if($row['hotel_name']) {
$row['name'] .= ' / '.$row['hotel_name'];
}
$products[in_array($row['id'], $selected) ? 'selected' : 'unselected'][] = $row;
}
// filter hotels as per accessed hotels
Expand All @@ -502,7 +508,6 @@ public function getProductRuleDisplay($product_rule_group_id, $product_rule_id,
1,
1
);

Context::getContext()->smarty->assign('product_rule_itemlist', $products);
$choose_content = $this->createTemplate('product_rule_itemlist.tpl')->fetch();
Context::getContext()->smarty->assign('product_rule_choose_content', $choose_content);
Expand Down