Hide Addresses
9 years 8 months ago #259802
by Joomill
Hide Addresses was created by Joomill
-- HikaShop version -- : 2.6.4
On this forums i found the Hide Addresses plugin.
It works great, but i would like to hide all addresses except the default address.
So would it be possible to add something like "if address_default != 1 " in this code?
On this forums i found the Hide Addresses plugin.
It works great, but i would like to hide all addresses except the default address.
So would it be possible to add something like "if address_default != 1 " in this code?
Code:
<?php
class plgHikashopAddress extends JPlugin
{
function __construct(&$subject, $config) {
parent::__construct($subject, $config);
}
function onAfterOrderCreate(&$order,&$send_email) {
if(empty($order->order_shipping_address_id) && empty($order->order_billing_address_id))
return true;
$address = hikashop_get('class.address');
if(!empty($order->order_shipping_address_id) && $order->order_shipping_address_id != $order->order_billing_address_id) {
$obj = new stdClass();
$obj->address_id = $order->order_shipping_address_id;
$obj->address_published = 0;
$address->save($obj);
}
if(!empty($order->order_billing_address_id)) {
$obj = new stdClass();
$obj->address_id = $order->order_billing_address_id;
$obj->address_published = 0;
$address->save($obj);
}
return true;
}
}
Please Log in or Create an account to join the conversation.
9 years 8 months ago #259816
by nicolas
Replied by nicolas on topic Hide Addresses
Hi,
Yes. Before the lines:
$address->save($obj);
You can add such code:
Yes. Before the lines:
$address->save($obj);
You can add such code:
Code:
$data = $address->get($obj->address_id);
if(!$data->address_default)
Please Log in or Create an account to join the conversation.
9 years 8 months ago #260191
by Joomill
Replied by Joomill on topic Hide Addresses
Thank you!
then another question:
When is an address a default?
I hoped it was the address what's used by registration, but sometimes it looks it's the shipping address.
then another question:
When is an address a default?
I hoped it was the address what's used by registration, but sometimes it looks it's the shipping address.
Please Log in or Create an account to join the conversation.
9 years 8 months ago #260199
by nicolas
Replied by nicolas on topic Hide Addresses
Hi,
The default address is the first one entered by the customer. And then he can change it in the My addresses area on his HikaShop user control panel.
The default address is the first one entered by the customer. And then he can change it in the My addresses area on his HikaShop user control panel.
Please Log in or Create an account to join the conversation.
Time to create page: 0.163 seconds