我正在为一家度假村预订公司修改 opencart。为此,我需要在产品页面中有多个复选框选项。但我没有从哪里计算单价,其中包括我所有的复选框、单选按钮选择的选项(价格)。如果我想编辑它,我可以在哪里做。
i will be having seasonwise date and values, when a checkbox selected it should compare the date selected by the user, if matches then get the value from there. 现在我在product_option_value
表格中添加了开始日期和结束日期。通过管理区域,我们可以在特定选项的前面输入日期。
我不知道在产品/购物车页面中仅计算选定值的方式和位置。
请建议我
这是我的网站,因为我无法附加图片,所以我提供了链接以查看我的页面。
我将在我的产品页面中有多个选择,我的意思是三个单人选项,三个成人选项......(取决于季节),它们将通过管理区域在产品页面的选项选项卡的日期区域中指定。现在我所有的计算都可以了。但是当我选择复选框(比如我选择单个)时,它应该检查用户输入日期的开始日期和结束日期,其中“单个”(因为单个条目有多个条目)具有用户输入日期之间的日期,它应该为此选择价格,然后它应该在购物车页面中给出单价。
但现在它只是在不检查日期的情况下选择价格。如果我可以在没有价格的情况下传递选定复选框的 ID,那么我可以在那里计算其余部分。我没有得到这个。
这是我的目录/控制器/checkout/cart.php
$option_data[] = array(
'product_option_id' => $option['product_option_id'],
'option_id' => $option['option_id'],
'type' => $option['type'],
'name' => $option['name'],
'price' => $option['value'],
'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value)
);
//echo $option['value'];
//echo $option['option_value_id'];
//echo $option['type'];
if($option['type'] == "checkbox")
{
$id = $option['option_value_id'];
//echo $id;
}
if($option['name'] =="Check-In")
{
$this->data['value1'] = $value;
$this->data['date1'] = $this->data['value1'];
// $this->data['date1'];
$_SESSION['data12'] = $this->data['date1'];
}
//echo $_SESSION['data12'];
$this->data['mydate1'] = strtotime($_SESSION['data12']);
if($option['name'] == "Check-Out")
{
$this->data['value2'] = $option['option_value'];
$this->data['date2'] = $this->data['value2'];
$_SESSION['data13'] = $this->data['date2'];
// $this->data['date2'];
}
$this->data['mydate2'] = strtotime($_SESSION['data13']);
$difference = abs(($this->data['mydate2']) - ($this->data['mydate1']));
$this->data['totaldays1'] = floor($difference/(60*60*24));
// $this->data['totaldays1'];
$total123 = (int)$this->data['totaldays1'];
// $total123;
$_SESSION['tot123'] = $total123;
//$my3 = $_SESSION['tot123'];
//$this->data['my3'] = $_SESSION['tot123'];
}
////////////////////////////////////////////////////////////MY CODE SHOULD GO HERE******************************************
$roomRate = $this->currency->format($this->tax->getRatesofRooms($id, $_SESSION['data12'],$_SESSION['data13'] ));
//$roomRate = $this->currency->format($this->tax->getRatesofRooms($id, $_SESSION['data12'],$_SESSION['data13'] ));
//echo $roomRate;
//$price = $roomRate;
//echo $price;
//$product['price'] = $roomRate;
$product['price'] += $roomRate;
//echo $product['price'];
// Display prices
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
//echo $price;
}
else {
$price = false;
}
//$product['price'];
// Display prices
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$total = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $_SESSION['tot123']);
} else {
$total = false;
}
// $total1;
// $total1;
$this->data['products'][] = array(
'key' => $product['key'],
'thumb' => $image,
'name' => $product['name'],
'model' => $product['model'],
//'checkin' => $product['checkin'],
//'checkout' => $product['checkout'],
'option' => $option_data,
'quantity' => $product['quantity'],
'stock' => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')),
'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
'price' => $price,
'total' => $total,
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']),
'remove' => $this->url->link('checkout/cart', 'remove=' . $product['key'])
);
}
这里它计算价格,其中包括选定的复选框价格而不比较日期
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
//echo $price;
}
else {
$price = false;
}
我没有从它获得选中复选框值的地方得到。(演示/演示)您可以通过提供演示/演示 http://netelity.com/resort/admin在此链接中检查管理员