예제 #1
0
 public function getName($item = null)
 {
     if (!empty($item) && is_numeric($item)) {
         $this->load($item);
     } elseif (is_object($item) || is_array($item)) {
         $this->bind($item);
     }
     $params = new DSCParameter($this->params);
     if ($params->get('label')) {
         return $params->get('label');
     }
     return $this->name;
 }
예제 #2
0
 function display($tpl = null)
 {
     global $mainframe;
     // Check if registration is allowed
     $usersConfig = JComponentHelper::getParams('com_users');
     if (!$usersConfig->get('allowUserRegistration')) {
         JError::raiseError(403, JText::_('COM_TIENDA_ACCESS_FORBIDDEN'));
         return;
     }
     $pathway = $mainframe->getPathway();
     $document = JFactory::getDocument();
     $params =& $mainframe->getParams();
     // Page Title
     $menus = JSite::getMenu();
     $menu = $menus->getActive();
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new DSCParameter($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', JText::_('COM_TIENDA_REGISTRATION'));
         }
     } else {
         $params->set('page_title', JText::_('COM_TIENDA_REGISTRATION'));
     }
     $document->setTitle($params->get('page_title'));
     $pathway->addItem(JText::_('COM_TIENDA_NEW'));
     // Load the form validation behavior
     JHTML::_('behavior.formvalidation');
     $user = JFactory::getUser();
     $this->assignRef('user', $user);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
예제 #3
0
 function _displayForm($tpl = null)
 {
     global $mainframe;
     // Load the form validation behavior
     JHTML::_('behavior.formvalidation');
     $user = JFactory::getUser();
     $params = $mainframe->getParams();
     // check to see if Frontend User Params have been enabled
     $usersConfig = JComponentHelper::getParams('com_users');
     $check = $usersConfig->get('frontend_userparams');
     if ($check == '1' || $check == 1 || $check == NULL) {
         if ($user->authorize('com_user', 'edit')) {
             $params = $user->getParameters(true);
         }
     }
     $params->merge($params);
     $menus = JSite::getMenu();
     $menu = $menus->getActive();
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new DSCParameter($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', JText::_('COM_CITRUSCART_EDIT_YOUR_DETAILS'));
         }
     } else {
         $params->set('page_title', JText::_('COM_CITRUSCART_EDIT_YOUR_DETAILS'));
     }
     $document = JFactory::getDocument();
     $document->setTitle($params->get('page_title'));
     $this->assignRef('user', $user);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
예제 #4
0
 /**
  * Display function
  *
  * @since 1.5
  */
 function display($tpl = null)
 {
     jimport('joomla.html.html');
     $mainframe = JFactory::getApplication();
     // Get the page/component configuration
     $params =& $mainframe->getParams();
     $menus = JSite::getMenu();
     $menu = $menus->getActive();
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new DSCParameter($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', JText::_('COM_TIENDA_FORGOT_YOUR_USERNAME'));
         }
     } else {
         $params->set('page_title', JText::_('COM_TIENDA_FORGOT_YOUR_USERNAME'));
     }
     $document = JFactory::getDocument();
     $document->setTitle($params->get('page_title'));
     // Load the form validation behavior
     JHTML::_('behavior.formvalidation');
     // Add the tooltip behavior
     JHTML::_('behavior.tooltip');
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
예제 #5
0
파일: tienda.php 프로젝트: annggeel/tienda
 /**
  * Displays the Tienda add to cart button
  * 
  * @param $row
  * @param $user
  * @return unknown_type
  */
 function displayCartButton($row, $user)
 {
     $params = new DSCParameter(trim($row->params));
     $product_id = $params->get('tienda_product_id');
     JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
     $model = JModel::getInstance('Products', 'TiendaModel');
     $model->setId($product_id);
     $product = $model->getItem();
     if (!empty($product_id) && !empty($product->product_id)) {
         Tienda::load('TiendaHelperProduct', 'helpers.product');
         if ($this->params->get('redirect_to_tienda') == '1') {
             Tienda::load("TiendaHelperRoute", 'helpers.route');
             $router = new TiendaHelperRoute();
             $link = $router->product($eventproduct->product_id);
             $redirect = JRoute::_($link, false);
             $app = JFactory::getApplication();
             $app->redirect($redirect);
             return;
         }
         // set the redirect
         if ($this->params->get('redirect_back_to_ambrasubs') == '1') {
             $uri = JURI::getInstance();
             $redirect = $uri->toString();
             $return = '';
         } else {
             Tienda::load("TiendaHelperRoute", 'helpers.route');
             $router = new TiendaHelperRoute();
             $itemid = $router->findItemid(array('view' => 'checkout'));
             $redirect = JRoute::_("index.php?option=com_tienda&view=carts&Itemid=" . $itemid, false);
             $uri = JURI::getInstance();
             $return = $uri->toString();
         }
         $vars->redirect = $redirect;
         $vars->return = $return;
         $vars->ambrasubs_type = $row;
         $vars->product = $product;
         echo $this->_getLayout('product_buy', $vars, $this->_element, 'ambrasubs');
     }
 }
예제 #6
0
 /**
  * Display function
  *
  * @since 1.5
  */
 function display($tpl = null)
 {
     jimport('joomla.html.html');
     global $mainframe;
     // Load the form validation behavior
     JHTML::_('behavior.formvalidation');
     // Add the tooltip behavior
     JHTML::_('behavior.tooltip');
     // Get the layout
     $layout = $this->getLayout();
     if ($layout == 'complete') {
         $id = $mainframe->getUserState($this->_namespace . 'id');
         $token = $mainframe->getUserState($this->_namespace . 'token');
         if (is_null($id) || is_null($token)) {
             $mainframe->redirect('index.php?option=com_user&view=reset');
         }
     }
     // Get the page/component configuration
     $params =& $mainframe->getParams();
     $menus = JSite::getMenu();
     $menu = $menus->getActive();
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new DSCParameter($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', JText::_('COM_TIENDA_FORGOT_YOUR_PASSWORD'));
         }
     } else {
         $params->set('page_title', JText::_('COM_TIENDA_FORGOT_YOUR_PASSWORD'));
     }
     $document = JFactory::getDocument();
     $document->setTitle($params->get('page_title'));
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
예제 #7
0
foreach ($modules as $mod) {
    echo $renderer->render($mod, $attribs);
}
?>
        </td>
        <td style="vertical-align: top; width: 30%; min-width: 30%; padding: 0px 0px 0px 5px;">

            <?php 
$modules = JModuleHelper::getModules("citruscart_product_dashboard_right");
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$attribs = array();
$attribs['style'] = 'xhtml';
foreach ($modules as $mod) {
    $mod_params = new DSCParameter($mod->params);
    if ($mod_params->get('hide_title', '1')) {
        $mod->showtitle = '0';
    }
    echo $renderer->render($mod, $attribs);
}
?>
        </td>
    </tr>
    </table>

<input type="hidden" name="id" value="<?php 
echo $row->product_id;
?>
" />
<input type="hidden" name="task" id="task" value="" />
</form>
예제 #8
0
    ?>
            <?php 
    foreach ($items as $item) {
        ?>

            	<?php 
        $params = new DSCParameter(trim($item->wishlistitem_params));
        $default_url = "index.php?option=com_citruscart&view=products&task=view&id=" . $item->product_id;
        $attributes = CitruscartHelperProduct::convertAttributesToArray($item->product_id, $item->product_attributes);
        for ($j = 0, $c = count($attributes); $j < $c; $j++) {
            $default_url .= '&attribute_' . $attributes[$j][0] . '=' . $attributes[$j][1];
        }
        if ($itemid = $products_model->getItemid($item->product_id)) {
            $default_url .= "&Itemid=" . $itemid;
        }
        $link = $params->get('product_url', $default_url);
        $link = JRoute::_($link);
        ?>

                <tr class="row<?php 
        echo $k;
        ?>
 wishlistitem-<?php 
        echo $item->wishlistitem_id;
        ?>
">
                    <td>
                        <a class="delete-wishlistitem btn btn-danger" href="javascript:void(0);" data-wishlistitem_id="<?php 
        echo $item->wishlistitem_id;
        ?>
">
예제 #9
0
 /**
  * Method to count the number of plugin assigned to a geozone
  * @param obj $geozone 
  * @return int
  */
 public static function countPlgtoGeozone($geozone)
 {
     $count = 0;
     if (!is_object($geozone)) {
         return $count;
     }
     static $plugins;
     static $geozones;
     if (empty($plugins[$geozone->geozonetype_id])) {
         $suffix = CitruscartHelperPlugin::getSuffix($geozone->geozonetype_id);
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
         $model = JModelLegacy::getInstance($suffix, 'CitruscartModel');
         $model->setState('filter_enabled', '1');
         $plugins[$geozone->geozonetype_id] = $model->getList();
     }
     foreach ($plugins[$geozone->geozonetype_id] as $plugin) {
         if (isset($plugin->params)) {
             if (empty($geozones[$plugin->id])) {
                 $params = new DSCParameter($plugin->params);
                 $geozones[$plugin->id] = explode(',', $params->get('geozones'));
             }
             if (in_array($geozone->geozone_id, $geozones[$plugin->id])) {
                 $count++;
             }
         }
     }
     return $count;
 }
예제 #10
0
 /**
  * If enabled, delete product on google
  * @param $product
  */
 function onAfterDeleteProducts($product, $product_id)
 {
     // Check if it's enabled automatic syncing and the user has defined the account id for google
     if (!$this->params->get('auto_sync', '1') || !$this->account_id) {
         return false;
     }
     // Now let's get serious: was this product already saved on google?
     $params = new DSCParameter(trim($product->product_params));
     $enabled = $params->get('sent_to_google', '0');
     $enabled = '1';
     if ($enabled) {
         // Delete also on google
         if ($this->deleteProduct($product)) {
             return true;
         } else {
             // Something went wrong
             JError::raiseWarning('GOOGLE_DELETE_ERR', JText::_('COM_TIENDA_ERROR_WHILE_DELETING_IN_GOOGLE_PRODUCTS') . $this->getError());
             return false;
         }
     }
     return true;
 }
예제 #11
0
 /**
  * Method to assign payment/shipping methods to the geozones
  */
 function selectplugins()
 {
     $app = JFactory::getApplication();
     $type = $app->input->get('type');
     Citruscart::load("CitruscartHelperPlugin", 'helpers.plugin');
     $suffix = CitruscartHelperPlugin::getSuffix($type);
     $state = parent::_setModelState();
     $app = JFactory::getApplication();
     $model = $this->getModel($suffix);
     $ns = $app->getName() . '::' . 'com.citruscart.model.' . $model->getTable()->get('_suffix');
     $id = $app->input->get('id', 0);
     $row = $model->getTable('geozones');
     $row->load($id);
     $state['filter_enabled'] = '1';
     $state['filter_name'] = $app->getUserStateFromRequest($ns . 'name', 'filter_name', '', '');
     $state['order'] = $app->getUserStateFromRequest($ns . '.filter_order', 'filter_order', 'tbl.name', 'cmd');
     foreach ($state as $key => $value) {
         $model->setState($key, $value);
     }
     $view = $this->getView('geozones', 'html');
     $view->set('_controller', 'geozones');
     $view->set('_view', 'geozones');
     $view->set('leftMenu', false);
     $view->set('_action', "index.php?option=com_citruscart&controller=geozones&task=selectplugins&type={$type}&tmpl=component&id=" . $model->getId());
     $view->setModel($model, true);
     $items = $model->getList();
     foreach ($items as $item) {
         $params = new DSCParameter($item->params);
         $item->geozones = explode(',', $params->get('geozones'));
     }
     $view->assign('suffix', $suffix);
     $view->assign('state', $model->getState());
     $view->assign('row', $row);
     $view->setLayout('selectplugins');
     $view->setTask(true);
     $view->display();
 }
예제 #12
0
파일: tienda.php 프로젝트: annggeel/tienda
 function onBeforeK2Save(&$item, $isNew)
 {
     //Check if Tienda is installed
     if (!$this->_isInstalled()) {
         return;
     }
     //Get Tienda plugin variables
     $tiendaParams = new K2Parameter($item->plugins, '', $this->_name);
     //Get All plugins variables
     $plugins = new DSCParameter($item->plugins);
     //Handle assignment
     if (JRequest::getBool('tiendaAssign')) {
         $plugins->merge($tiendaParams);
         $item->plugins = $plugins->toString();
         return;
     }
     //Handle unassignment
     if (JRequest::getBool('tiendaUnassign')) {
         $plugins->set('tiendaproductID', NULL);
         $plugins->set('tiendaproductName', NULL);
         $plugins->set('tiendaproductSKU', NULL);
         $plugins->set('tiendaproductTax', NULL);
         $plugins->set('tiendaproductManufacturer', NULL);
         $plugins->set('tiendaproductWeight', NULL);
         $plugins->set('tiendaproductLength', NULL);
         $plugins->set('tiendaproductWidth', NULL);
         $plugins->set('tiendaproductHeight', NULL);
         $plugins->set('tiendaproductShipping', NULL);
         $plugins->set('tiendaproductEnabled', NULL);
         $item->plugins = $plugins->toString();
         return;
     }
     //Handle unassignment
     if (JRequest::getBool('tiendaRemove')) {
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
         $product = JTable::getInstance('Products', 'TiendaTable');
         $product->delete($plugins->get('tiendaproductID'));
         $plugins->set('tiendaproductID', NULL);
         $plugins->set('tiendaproductName', NULL);
         $plugins->set('tiendaproductSKU', NULL);
         $plugins->set('tiendaproductTax', NULL);
         $plugins->set('tiendaproductManufacturer', NULL);
         $plugins->set('tiendaproductWeight', NULL);
         $plugins->set('tiendaproductLength', NULL);
         $plugins->set('tiendaproductWidth', NULL);
         $plugins->set('tiendaproductHeight', NULL);
         $plugins->set('tiendaproductShipping', NULL);
         $plugins->set('tiendaproductEnabled', NULL);
         $item->plugins = $plugins->toString();
         return;
     }
     //Handle form
     if ($tiendaParams->get('productName', NULL) && $tiendaParams->get('productSKU', NULL)) {
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
         $product = JTable::getInstance('Products', 'TiendaTable');
         $product->product_id = $tiendaParams->get('productID', NULL);
         $product->product_name = $tiendaParams->get('productName', NULL);
         $product->product_sku = $tiendaParams->get('productSKU', NULL);
         $product->manufacturer_id = $tiendaParams->get('productManufacturer', 0);
         $product->tax_class_id = $tiendaParams->get('productTax');
         $product->product_weight = $tiendaParams->get('productWeight', NULL);
         $product->product_length = $tiendaParams->get('productLength', NULL);
         $product->product_width = $tiendaParams->get('productWidth', NULL);
         $product->product_height = $tiendaParams->get('productHeight', NULL);
         $product->product_ships = $tiendaParams->get('productShipping', 0);
         $product->product_enabled = $tiendaParams->get('productEnabled', 1);
         $product->save();
         $tiendaParams->set('tiendaproductID', $product->product_id);
         $price = $tiendaParams->get('productPrice', NULL);
         if ($price) {
             $price = JTable::getInstance('ProductPrices', 'TiendaTable');
             $price->product_id = $product->product_id;
             $price->product_price = $tiendaParams->get('productPrice', NULL);
             $price->save();
         }
         $plugins->merge($tiendaParams);
         $item->plugins = $plugins->toString();
     }
 }
예제 #13
0
define('TPATH_BASE', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
$pathXplode = explode("/plugins", TPATH_BASE);
require_once $pathXplode[0] . '/index.php';
jimport('joomla.plugin.plugin');
$plugin = JPluginHelper::getPlugin('tienda', 'payment_googlecheckout');
$params = new DSCParameter($plugin->params);
chdir("..");
require_once dirname(__FILE__) . '/googleresponse.php';
require_once dirname(__FILE__) . '/googlemerchantcalculations.php';
require_once dirname(__FILE__) . '/googleresult.php';
require_once dirname(__FILE__) . '/googlerequest.php';
$path = JPATH_ROOT . '/cache';
define('RESPONSE_HANDLER_ERROR_LOG_FILE', $path . '/googleerror.log');
define('RESPONSE_HANDLER_LOG_FILE', $path . '/googlemessage.log');
$server_type = $params->get('sandbox') ? "sandbox" : "production";
// change this to go live
$merchant_id = $params->get('sandbox') ? $params->get('sandbox_merchant_id') : $params->get('merchant_id');
// Your Merchant ID
$merchant_key = $params->get('sandbox') ? $params->get('sandbox_merchant_key') : $params->get('merchant_key');
// Your Merchant Key
$currency = $params->get('currency');
// set to GBP if in the UK
$Gresponse = new GoogleResponse($merchant_id, $merchant_key);
$Grequest = new GoogleRequest($merchant_id, $merchant_key, $server_type, $currency);
//$response->SetLogFiles($path . '/google_error.log', $path . '/google_message.log', L_ALL);
//Setup the log file
$Gresponse->SetLogFiles(RESPONSE_HANDLER_ERROR_LOG_FILE, RESPONSE_HANDLER_LOG_FILE, L_ALL);
// Retrieve the XML sent in the HTTP POST request to the ResponseHandler
$xml_response = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");
if (get_magic_quotes_gpc()) {
 /**
  * Search for the tag and replace it with the product view {Citruscartproduct}
  *
  * @param $article
  * @param $params
  * @param $limitstart
  */
 private function doContentPrepare($context, &$row, &$params, $page = 0)
 {
     if (!$this->isInstalled()) {
         return true;
     }
     // simple performance check to determine whether bot should process further
     if (JString::strpos($row->text, 'citruscartproduct') === false) {
         return true;
     }
     // Get plugin info
     $plugin = JPluginHelper::getPlugin('content', 'citruscart_content_product');
     // expression to search for
     $regex = '/{citruscartproduct\\s*.*?}/i';
     $pluginParams = new DSCParameter($plugin->params);
     // check whether plugin has been unpublished
     if (!$pluginParams->get('enabled', 1)) {
         $row->text = preg_replace($regex, '', $row->text);
         return true;
     }
     // find all instances of plugin and put in $matches
     preg_match_all($regex, $row->text, $matches);
     // Number of plugins
     $count = count($matches[0]);
     // plugin only processes if there are any instances of the plugin in the text
     if ($count) {
         DSC::loadJQuery('latest', true, 'citruscartJQ');
         $doc = JFactory::getDocument();
         $uri = JURI::getInstance();
         $js = "var com_citruscart = {};\n";
         $js .= "com_citruscart.jbase = '" . $uri->root() . "';\n";
         $doc->addScriptDeclaration($js);
         foreach ($matches as $match) {
             $this->showProducts($row, $matches, $count, $regex);
         }
     }
 }