/** * Set selected saved shipping addresses for this user * * @param int saved address ID * @return bool */ public function setSavedShippingAddress($saId) { // check if the address correct if (!CartHelper::isNonNegativeInt($saId)) { throw new \Exception(Lang::txt('COM_CART_INCORRECT_SAVED_SHIPPING_ADDRESS')); } $sql = "SELECT * FROM `#__cart_saved_addresses` WHERE `saId` = " . $this->_db->quote($saId); $this->_db->setQuery($sql); $this->_db->query(); if ($this->_db->getNumRows() < 1) { throw new \Exception(Lang::txt('COM_CART_INCORRECT_SAVED_SHIPPING_ADDRESS')); } $sql = "UPDATE `#__cart_transaction_info` ti, (SELECT * FROM `#__cart_saved_addresses` WHERE `saId` = " . $this->_db->quote($saId) . ") sa\n\t\t\t\tSET\n\t\t\t\tti.`tiShippingToFirst` = sa.`saToFirst`,\n\t\t\t\tti.`tiShippingToLast` = sa.`saToLast`,\n\t\t\t\tti.`tiShippingAddress` = sa.`saAddress`,\n\t\t\t\tti.`tiShippingCity` = sa.`saCity`,\n\t\t\t\tti.`tiShippingState` = sa.`saState`,\n\t\t\t\tti.`tiShippingZip` = sa.`saZip`\n\n\t\t\t\tWHERE ti.`tId` = {$this->cart->tId}"; $this->_db->setQuery($sql); $this->_db->query(); return true; }
* GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Ilya Shunko <*****@*****.**> * @copyright Copyright 2005-2011 Purdue University. All rights reserved. * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPLv3 */ // No direct access defined('_HZEXEC_') or die; require_once dirname(dirname(dirname(dirname(__DIR__)))) . DS . 'helpers' . DS . 'Helper.php'; $states = \Components\Cart\Helpers\CartHelper::getUsStates(); $this->css(); ?> <header id="content-header"> <h2>Checkout: shipping information</h2> </header> <?php if (!empty($this->notifications)) { $view = new \Hubzero\Component\View(array('name' => 'shared', 'layout' => 'notifications')); $view->notifications = $this->notifications; $view->display(); } ?>
/** * Verify security token * * @param string string token * @param int Transaction ID * @return bool */ public static function verifySecurityToken($token, $tId) { if (!CartHelper::isNonNegativeInt($tId, false)) { throw new \Exception(Lang::txt('COM_CART_NO_TRANSACTION_FOUND')); } return md5(self::$securitySalt . $tId) == $token; }