/** * Get default address for this collection and address type * @return AddressModel */ protected function getDefaultAddress() { $objAddress = AddressModel::findOneBy(array('ptable=?', 'pid=?', 'isDefaultShipping=?'), array('tl_iso_product_collection', Isotope::getCart()->id, '1')); if (null === $objAddress) { $objShippingAddress = Isotope::getCart()->getShippingAddress(); if (null === $objShippingAddress) { $objAddress = new AddressModel(); } else { $objAddress = clone $objShippingAddress; } $objAddress->ptable = 'tl_iso_product_collection'; $objAddress->pid = Isotope::getCart()->id; $objAddress->isDefaultShipping = '1'; $objAddress->isDefaultBilling = ''; if ($objAddress->country == '') { $objAddress->country = Isotope::getConfig()->shipping_country; } } return $objAddress; }