golive69 wrote: ↑Sun Oct 17, 2021 9:10 am
OC 2.3.0.2
I want to show info to a geo zone group. The sample code below works for customer group.
Code: Select all
<?php if($this->customer->getGroupId() == 3) { ?>
<h3 style="text-align: center;">
<?php
$total = $this->cart->getTotal();
$sum = (75-$total);
if ($total >= 75) {
echo "¡Gracias por tu pedido, obtienes <b>ENVÍO GRATIS!</b>"; }
else {
echo "¡Agregue US$".$sum." a su carrito para <b>ENVÍO GRATIS!</b>";
}
?>
</h3><br>
<?php } ?>
Also can I insert another group ID where I show 3 above?
For multiple customer groups, replace:
Code: Select all
<?php if($this->customer->getGroupId() == 3) { ?>
with:
Code: Select all
<?php
$customer_group_data = array(
1,
2,
3
);
if (in_array($this->customer->getGroupId(), $customer_group_data)) {
?>
You can, then, replace 1,2,3 with the specific groups.
As for the geo zone ID from the customer, this might be a bit more complexed. The portion of the code you might be looking for to integrate:
Code: Select all
<?php
$this->load->model('account/address');
$address_info = $this->model_account_address->getAddress($this->customer->getAddressId());
if ($address_info->num_rows) {
$geo_zones = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone_to_geo_zone` ztgz INNER JOIN `" . DB_PREFIX . "geo_zone` gz ON (ztgz.`geo_zone_id` = gz.`geo_zone_id`) WHERE ztgz.`zone_id` = '" . (int)$address_info->row['zone_id'] . "' AND ztgz.`country_id` = '" . (int)$address_info->row['country_id'] . "'");
if ($geo_zones->num_rows) {
$geo_zone_data = array(
1,
2,
3
);
foreach ($geo_zones->rows as $result) {
if (in_array($result['geo_zone_id'], $geo_zone_data)) {
}
}
}
}
?>
Do the same to customize your 1,2,3 in the $geo_zone_data . However, what you are requesting should be done in the controller by using an Event trigger rather than playing directly in your TPL file as it is not recommended.