News:

Looking for documentation? Take a look on our wiki

Main Menu

Alternative Shipping Address

Started by malik0206, February 18, 2015, 19:50:01 PM

Previous topic - Next topic

malik0206

Hi

I need urgent help can someone please respond

I dont understand why the developers done this but i need it to be removed

under Alternative Shipping Address on Checkout page the (- Default same as Billing) is a hyper link which take the user to edit address

I need to remove the hyper link

Can anybody help me please i have looked though pretty much all the files and can't find where its making the link


your help is much appreciated

Thanks

malik0206


GJC Web Design

com_virtuemart\views\cart\tmpl\default_pricelist.php  ~ line 95
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

malik0206

Hi

Thanks but it not for default_pricelist.php

this is the line i'm trying to find where its getting the information from (echo $this->cart->lists['shipTo'];)

cart/tmpl/default_address.php

i'm trying to remove the hyperlink for the radio button

Thanks

AH

#4
Malik

Yep completely agree about the annoying link!!

I also prefer a drop down rather than a radio buttons (the radio only appears for registered users)

components/com_virtuemart/views/cart/view.html.php

This removes the links and creates a drop down selection list



function renderCompleteAddressList(){

$addressList = false;

if($this->cart->user->virtuemart_user_id){
$addressList = array();
//quorvia remove href from dropdown list
// $newBT = '<a href="index.php'
// .'?option=com_virtuemart'
// .'&view=user'
// .'&task=editaddresscart'
// .'&addrtype=BT'
// . '">'.vmText::_('COM_VIRTUEMART_ACC_BILL_DEF').'</a></br>';
$newBT = vmText::_('COM_VIRTUEMART_ACC_BILL_DEF');

foreach($this->cart->user->userInfo as $userInfo){
$address = $userInfo->loadFieldValues(false);
if($address->address_type=='BT'){
$address->virtuemart_userinfo_id = 0;
$address->address_type_name = $newBT;
array_unshift($addressList,$address);
} else {
//quorvia remove href from dropdown list
// $address->address_type_name = '<a href="index.php'
// .'?option=com_virtuemart'
// .'&view=user'
// .'&task=editaddresscart'
// .'&addrtype=ST'
// .'&virtuemart_userinfo_id='.$address->virtuemart_userinfo_id
////QUORVIA added zip for easier id of address
// . '" rel="nofollow">'.$address->address_type_name.' - '.$address->zip.'</a></br>';
$address->address_type_name =$address->address_type_name.' - '.$address->zip;

$addressList[] = $address;
}
}
if(count($addressList)==0){
$addressList[0] = new stdClass();
$addressList[0]->virtuemart_userinfo_id = 0;
$addressList[0]->address_type_name = $newBT;
}

$_selectedAddress = (
empty($this->cart->selected_shipto)
? $addressList[0]->virtuemart_userinfo_id // Defaults to 1st BillTo
: $this->cart->selected_shipto
);
//quorvia changed to drop selection;
$this->cart->lists['shipTo'] = JHtml::_('select.genericlist', $addressList, 'shipto', 'class="vm-chzn-select" style="width: 200px"', 'virtuemart_userinfo_id', 'address_type_name', $_selectedAddress);

// $this->cart->lists['shipTo'] = JHtml::_('select.radiolist', $addressList, 'shipto', null, 'virtuemart_userinfo_id', 'address_type_name', $_selectedAddress);
$this->cart->lists['billTo'] = empty($addressList[0]->virtuemart_userinfo_id)? 0 : $addressList[0]->virtuemart_userinfo_id;
} else {
$this->cart->lists['shipTo'] = false;
$this->cart->lists['billTo'] = false;
}
}


This refreshes the page to show the selected address (if not the same as bill to)
If you want the new address to show when you change selection you need to add some js in the

templates/YOURTEMPLATE/html/com_virtuemart/cart/default.php



vmJsApi::addJScript('vm.shiptoChange','
jQuery(document).ready(function () {
jQuery("#shipto").change(function(){
var form = jQuery("#checkoutFormSubmit");
document.checkoutForm.submit();
});

if (jQuery("#shipto").chosen().val() == "0"){
jQuery("#output-shipto-display").hide();

}
});
');





And if you want the ZIP code added to the shipping address type name - for easier ID

components/com_virtuemart/helpers/shopfunctionsf.php



* This generates the list when the user have different ST addresses saved
*
* @author Oscar van Eijk
*/
static function generateStAddressList ($view, $userModel, $task) {

// Shipment address(es)
$_addressList = $userModel->getUserAddressList ($userModel->getId (), 'ST');
if (count ($_addressList) == 1 && empty($_addressList[0]->address_type_name)) {
return vmText::_ ('COM_VIRTUEMART_USER_NOSHIPPINGADDR');
} else {
$_shipTo = array();
$useXHTTML = empty($view->useXHTML) ? false : $view->useXHTML;
$useSSL = empty($view->useSSL) ? FALSE : $view->useSSL;

for ($_i = 0; $_i < count ($_addressList); $_i++) {
if (empty($_addressList[$_i]->virtuemart_user_id)) {
$_addressList[$_i]->virtuemart_user_id = JFactory::getUser ()->id;
}
if (empty($_addressList[$_i]->virtuemart_userinfo_id)) {
$_addressList[$_i]->virtuemart_userinfo_id = 0;
}
if (empty($_addressList[$_i]->address_type_name)) {
$_addressList[$_i]->address_type_name = 0;
}

$_shipTo[] = '<li>' . '<a href="index.php'
. '?option=com_virtuemart'
. '&view=user'
. '&task=' . $task
. '&addrtype=ST'
. '&virtuemart_user_id[]=' . $_addressList[$_i]->virtuemart_user_id
//QUORVIA added zip for easier id of address
. '&virtuemart_userinfo_id=' . $_addressList[$_i]->virtuemart_userinfo_id
. '">' . $_addressList[$_i]->address_type_name . ' - '.  $_addressList[$_i]->zip. '</a> ' ;

$_shipTo[] = '&nbsp;&nbsp;<a href="'.JRoute::_ ('index.php?option=com_virtuemart&view=user&task=removeAddressST&virtuemart_user_id[]=' . $_addressList[$_i]->virtuemart_user_id . '&virtuemart_userinfo_id=' . $_addressList[$_i]->virtuemart_userinfo_id, $useXHTTML, $useSSL ). '" class="icon_delete">'.vmText::_('COM_VIRTUEMART_USER_DELETE_ST').'</a></li>';

}


Regards
A

Joomla 4.4.5
php 8.1

malik0206

Great thanks for your help this works just perfect

Thanks again