Example #1
0
 function makeDownload()
 {
     global $Itemid;
     if ($this->_customer->_user->id < 1) {
         $this->setRedirect(JRoute::_($this->log_link, false));
         return;
     }
     $fileInfo = $this->_model->getfileinfo();
     DigiComSiteHelperDigiCom::checkUserAccessToFile($fileInfo, $this->_customer->_user->id);
     if (empty($fileInfo->url)) {
         $itemid = JFactory::getApplication()->input->get('itemid', 0);
         $msg = JText::sprintf('COM_DIGICOM_DOWNLOADS_FILE_DONT_EXIST_DETAILS', $fileInfo->name);
         JFactory::getApplication()->redirect('index.php?option=com_digicom&view=downloads&Itemid=' . $itemid, $msg);
     }
     $parsed = parse_url($fileInfo->url);
     if (empty($parsed['scheme'])) {
         $fileLink = JPATH_BASE . '/' . $fileInfo->url;
     } else {
         $fileLink = $fileInfo->url;
     }
     //update hits
     $files = JTable::getInstance('Files', 'Table');
     $files->load($fileInfo->id);
     $files->hits = $files->hits + 1;
     $files->store();
     $downloadfile = new DigiComSiteHelperDownloadFile($fileLink);
     if (!$downloadfile->df_download()) {
         $itemid = JFactory::getApplication()->input->get('itemid', 0);
         $msg = JText::sprintf("COM_DIGICOM_FILE_DOWNLOAD_FAILED", $fileInfo->name);
         JFactory::getApplication()->redirect('index.php?option=com_digicom&view=downloads&Itemid=' . $itemid, $msg);
     }
 }
Example #2
0
 function sajax_get_my_uri()
 {
     //print_r($_SERVER["REQUEST_URI"]);
     //		$sajax_remote_uri = $_SERVER["REQUEST_URI"];
     //change to
     $sajax_remote_uri = DigiComSiteHelperDigiCom::getLiveSite();
     $sajax_remote_uri .= "/index.php?option=com_digicom";
     //if there are any problems with country/province lists populating
     if (!strpos($sajax_remote_uri, "?option=com_digicom")) {
         $sajax_remote_uri .= '&option=com_digicom';
     }
     return $sajax_remote_uri . "&no_html=1&view=sajax";
 }
Example #3
0
 function display($tpl = null)
 {
     $customer = new DigiComSiteHelperSession();
     $app = JFactory::getApplication();
     $input = $app->input;
     $Itemid = $input->get("Itemid", 0);
     $return = base64_encode(JURI::getInstance()->toString());
     if ($customer->_user->id < 1) {
         $app->Redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return . '&Itemid=' . $Itemid, false));
         return true;
     }
     $db = JFactory::getDBO();
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $this->askforbilling = $configs->get('askforbilling', 1);
     $this->askforcompany = $configs->get('askforcompany', 1);
     $country_option = DigiComSiteHelperDigiCom::get_country_options($customer->_customer, false, $configs);
     $lists['country_option'] = $country_option;
     $lists['customerlocation'] = DigiComSiteHelperDigiCom::get_store_province($customer->_customer, false);
     $sql = "select * from #__digicom_states where eumember='1'";
     $db->setQuery($sql);
     $eucs = $db->loadObjectList();
     $eu = array();
     foreach ($eucs as $euc) {
         $eu[] = $euc->country;
     }
     $this->assign("eu", $eu);
     $eulocated = isset($customer->country) && in_array($customer->country, $eu);
     $this->assign("eulocated", $eulocated);
     $cclasses = @explode("\n", $customer->taxclass);
     $data = $this->get('listCustomerClasses');
     $select = '<select name="taxclass" >';
     if (count($data) > 0) {
         foreach ($data as $i => $v) {
             $select .= '<option value="' . $v->id . '" ';
             if (in_array($v->id, $cclasses)) {
                 $select .= ' selected ';
             }
             $select .= ' > ' . $v->name . '</option>';
         }
     }
     $select .= '</select>';
     $lists['customer_class'] = $select;
     $this->assign("lists", $lists);
     $this->assign("customer", $customer);
     $this->assign("configs", $configs);
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('profile');
     parent::display($tpl);
 }
Example #4
0
 public static function checkUserAccessToFile($fileInfo, $user_id)
 {
     //print_r($fileInfo);die;
     $user = JFactory::getUser($user_id);
     $access = DigiComSiteHelperDigiCom::getUsersProductAccess($user_id, $fileInfo->product_id);
     if ($access) {
         return true;
     }
     // Wrong Download ID
     $msg = array('access' => JText::_('COM_DIGICOM_DOWNLOADS_ACCESS_DENIED'));
     $msgcode = json_encode($msg);
     echo $msgcode;
     JFactory::getApplication()->close();
 }
Example #5
0
					<?php 
    }
    ?>
				</td>
				<td nowrap="nowrap" style="text-align: center;">
					<ul style="margin: 0; padding: 0;list-style-type: none;">
						<li class="digi_cart_total" style="font-weight: bold;font-size: 18px;text-align:right;"><?php 
    echo JText::_("COM_DIGICOM_TOTAL");
    ?>
</li>
					</ul>
				</td>
				<td nowrap="nowrap" style="text-align: center;">
					<ul style="margin: 0; padding: 0;list-style-type: none;">
						<li class="digi_cart_amount" id="cart_total" style="font-weight: bold;font-size: 18px;text-align:right;"><?php 
    echo DigiComSiteHelperDigiCom::format_price2($tax['taxed'], $tax['currency'], true, $configs);
    ?>
</li>
					</ul>
				</td>
			</tr>
		</table>

		<?php 
    if ($configs->get('showccont', 0) == 1) {
        ?>
			<div id="digicomcartcontinue" class="row-fluid continue-shopping">
				<div class="span8">
					<?php 
        echo JText::_("DIGI_PAYMENT_METHOD") . ": " . $this->plugins;
        $onclick = "document.getElementById('returnpage').value='checkout'; document.getElementById('type_button').value='checkout';";
Example #6
0
			</td>
		</tr>

		<tr>
			<td>
				<?php 
    echo JText::_("COM_DIGICOM_STATE");
    ?>
&nbsp;<span class="error">*</span>
			</td>

			<td>
				<?php 
    $customer = $this->customer;
    $customer->state = $this->userinfo->state;
    echo DigiComSiteHelperDigiCom::get_store_province($customer, false);
    ?>
			</td>
		</tr>

		<tr>
			<td>
				<?php 
    echo JText::_("COM_DIGICOM_ZIP");
    ?>
&nbsp;<span class="error">*</span>
			</td>

			<td>
				<input name="zipcode" type="text" id="zipcode"   size="30" class="digi_textbox" value="<?php 
    echo $this->userinfo->zipcode;
Example #7
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     //parent::commonCategoryDisplay();
     $this->commonCategoryDisplay();
     $this->configs = JComponentHelper::getComponent('com_digicom')->params;
     // Prepare the data
     // Get the metrics for the structural page layout.
     $params = $this->params;
     $numLeading = 0;
     $numIntro = $params->def('num_products', 9);
     $numLinks = 0;
     // Compute the product slugs and prepare description (runs content plugins).
     foreach ($this->items as $item) {
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
         $item->event = new stdClass();
         $dispatcher = JEventDispatcher::getInstance();
         // Old plugins: Ensure that text property is available
         if (!isset($item->text)) {
             $item->text = $item->description;
         }
         JPluginHelper::importPlugin('content');
         $dispatcher->trigger('onContentPrepare', array('com_digicom.category', &$item, &$item->params, 0));
         // Old plugins: Use processed text as description
         $item->description = $item->text;
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_digicom.category', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_digicom.category', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_digicom.category', &$item, &$item->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
         $item->images = DigiComSiteHelperDigiCom::getThumbnail($item->images);
     }
     // Check for layout override only if this is not the active menu item
     // If it is the active menu item, then the view and category id will match
     $app = JFactory::getApplication();
     $active = $app->getMenu()->getActive();
     $menus = $app->getMenu();
     $pathway = $app->getPathway();
     $title = null;
     if (!$active || (strpos($active->link, 'view=category') === false || strpos($active->link, '&id=' . (string) $this->category->id) === false)) {
         // Get the layout from the merged category params
         if ($layout = $this->category->params->get('category_layout')) {
             $this->setLayout($layout);
         }
     } elseif (isset($active->query['layout'])) {
         // We need to set the layout from the query in case this is an alternative menu item (with an alternative layout)
         $this->setLayout($active->query['layout']);
     }
     // For blog layouts, preprocess the breakdown of leading, intro and linked products.
     foreach ($this->items as $i => $item) {
         if ($i < $numLeading) {
             $this->lead_items[] = $item;
         } elseif ($i >= $numLeading && $i < $numLeading + $numIntro) {
             $this->intro_items[] = $item;
         } elseif ($i < $numLeading + $numIntro + $numLinks) {
             $this->link_items[] = $item;
         } else {
             continue;
         }
     }
     $this->columns = max(1, $params->def('num_columns', 1));
     $order = $params->def('multi_column_order', 1);
     if ($order == 0 && $this->columns > 1) {
         // Call order down helper
         $this->intro_items = DigiComHelperQuery::orderDownColumns($this->intro_items, $this->columns);
     }
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     }
     $title = $this->params->get('page_title', '');
     $id = (int) @$menu->query['id'];
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->get('sitename');
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     if (empty($title)) {
         $title = $this->category->title;
     }
     $this->document->setTitle($title);
     if ($this->category->metadesc) {
         $this->document->setDescription($this->category->metadesc);
     } elseif (!$this->category->metadesc && $this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     if ($this->category->metakey) {
         $this->document->setMetadata('keywords', $this->category->metakey);
     } elseif (!$this->category->metakey && $this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     if (!is_object($this->category->metadata)) {
         $this->category->metadata = new Registry($this->category->metadata);
     }
     if ($app->get('MetaAuthor') == '1' && $this->category->get('author', '')) {
         $this->document->setMetaData('author', $this->category->get('author', ''));
     }
     $mdata = $this->category->metadata->toArray();
     foreach ($mdata as $k => $v) {
         if ($v) {
             $this->document->setMetadata($k, $v);
         }
     }
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander('category');
     return parent::display($tpl);
 }
Example #8
0
 function sendRegConfirm($customer)
 {
     $cust_info = $customer;
     $my = JFactory::getUser();
     $database = JFactory::getDBO();
     $cart = $this->getInstance("cart", "digicomModel");
     $configs = $this->getInstance("Config", "digicomModel");
     $configs = $configs->getConfigs();
     $mes = new stdClass();
     $mes->body = "Template is empty";
     $sql = "SELECT * FROM #__digicom_mailtemplates where `type`='register'";
     $database->setQuery($sql);
     $db = JFactory::getDBO();
     $db->setQuery($sql);
     $mes = $db->loadObjectList();
     $mes = $mes[0];
     $message = $mes->body;
     JTable::addIncludePath(JPATH_COMPONENT_SITE . DS . 'tables');
     $email = $this->getTable("Mail");
     $date = JFactory::getDate();
     $timestamp = $date->toUnix();
     $email->date = $timestamp;
     $email->flag = "register";
     $email->email = trim($my->email);
     $subject = $mes->subject;
     // Replace all variables in template
     $flag = "order";
     $promo = $cart->get_promo($cust_info);
     if ($promo->id > 0) {
         $promoid = $promo->id;
         $promocode = $promo->code;
     } else {
         $promoid = '0';
         $promocode = '0';
     }
     $app = JFactory::getApplication();
     $sitename = trim($configs->get('store_name', 'DigiCom Store')) != '' ? $configs->get('store_name', 'DigiCom Store') : $app->getCfg('sitename');
     $siteurl = trim($configs->get('store_url', '')) != '' ? $configs->get('store_url', '') : $mosConfig_live_site;
     $ship_add = DigiComSiteHelperDigiCom::get_customer_shipping_add($my->id);
     $message = str_replace("[SHIPPING_ADDRESS]", $ship_add, $message);
     $message = str_replace("[SITENAME]", $sitename, $message);
     $message = str_replace("[CUSTOMER_COMPANY_NAME]", $my->company, $message);
     $message = str_replace("../%5BSITEURL%5D", $siteurl, $message);
     $message = str_replace("%5BSITEURL%5D", $siteurl, $message);
     $message = str_replace("[SITEURL]", $siteurl, $message);
     $query = "select `lastname` from `#__digicom_customers` where `id`=" . $my->id;
     $database->setQuery($query);
     $lastname = $database->loadResult();
     $message = str_replace("[CUSTOMER_USER_NAME]", $my->username, $message);
     $message = str_replace("[CUSTOMER_FIRST_NAME]", $my->name, $message);
     $message = str_replace("[CUSTOMER_LAST_NAME]", $lastname, $message);
     $message = str_replace("[CUSTOMER_EMAIL]", $my->email, $message);
     $message = str_replace("[TODAY_DATE]", date($configs->get('time_format', 'd-m-Y'), $timestamp), $message);
     $message = str_replace("[CUSTOMER_PASSWORD]", $customer['password_confirm'], $message);
     $displayed = array();
     $product_list = '';
     $email->body = $message;
     //subject
     $subject = str_replace("[SHIPPING_ADDRESS]", $ship_add, $subject);
     $subject = str_replace("[SITENAME]", $sitename, $subject);
     $subject = str_replace("[CUSTOMER_COMPANY_NAME]", $my->copany, $subject);
     $subject = str_replace("../%5BSITEURL%5D", $siteurl, $subject);
     $subject = str_replace("%5BSITEURL%5D", $siteurl, $subject);
     $subject = str_replace("[SITEURL]", $siteurl, $subject);
     $subject = str_replace("[CUSTOMER_USER_NAME]", $my->username, $subject);
     $subject = str_replace("[CUSTOMER_FIRST_NAME]", $my->name, $subject);
     $subject = str_replace("[CUSTOMER_LAST_NAME]", $lastname, $subject);
     $subject = str_replace("[CUSTOMER_EMAIL]", $my->email, $subject);
     $subject = str_replace("[TODAY_DATE]", date($configs->get('time_format', 'd-m-Y'), $timestamp), $subject);
     $subject = str_replace("[CUSTOMER_PASSWORD]", $customer['password_confirm'], $subject);
     $subject = html_entity_decode($subject, ENT_QUOTES);
     $message = html_entity_decode($message, ENT_QUOTES);
     // Send email to user
     //			global $mosConfig_mailfrom, $mosConfig_fromname, $configs;
     $mosConfig_mailfrom = $app->getCfg("mailfrom");
     $mosConfig_fromname = $app->getCfg("fromname");
     if ($configs->get('usestoremail', 1) == '1' && strlen(trim($configs->get('store_name', 'DigiCom Store'))) > 0 && strlen(trim($configs->get('store_email', ''))) > 0) {
         $adminName2 = $configs->get('store_name', 'DigiCom Store');
         $adminEmail2 = $configs->get('store_email', '');
     } else {
         if ($mosConfig_mailfrom != "" && $mosConfig_fromname != "") {
             $adminName2 = $mosConfig_fromname;
             $adminEmail2 = $mosConfig_mailfrom;
         } else {
             $query = "SELECT name, email" . "\n FROM #__users" . "\n WHERE LOWER( usertype ) = 'superadministrator'" . "\n OR LOWER( usertype ) = 'super administrator'";
             $database->setQuery($query);
             $rows = $database->loadObjectList();
             $row2 = $rows[0];
             $adminName2 = $row2->name;
             $adminEmail2 = $row2->email;
         }
     }
     $mailSender = JFactory::getMailer();
     $mailSender->IsHTML(true);
     $mailSender->addRecipient($my->email);
     $mailSender->setSender(array($adminEmail2, $adminName2));
     $mailSender->setSubject($subject);
     $mailSender->setBody($message);
     if (!$mailSender->Send()) {
         //			<Your error code management>
     } else {
         $email->store();
     }
     //			mosMail( $adminEmail2, $adminName2, $my->email, $subject, $message, 1 ); // Send mail
     if ($configs->get('sendmailtoadmin', 1) != 0) {
         $mailSender = JFactory::getMailer();
         $mailSender->IsHTML(true);
         $mailSender->addRecipient($adminEmail2);
         $mailSender->setSender(array($adminEmail2, $adminName2));
         $mailSender->setSubject($subject);
         $mailSender->setBody($message);
         if (!$mailSender->Send()) {
             //					<Your error code management>
         } else {
             $email->store();
         }
         $site_config = JFactory::getConfig();
         $tzoffset = $site_config->get('offset');
         $today = date('Y-m-d H:i:s', time() + $tzoffset);
         $sql = "insert into #__digicom_logs(`userid`, `emailname`, `to`, `subject`, `body`, `send_date`) values (" . $my->id . ", 'New Customer Email', '" . $my->email . "', '" . addslashes(trim($subject)) . "', '" . addslashes($message) . "', '" . $today . "')";
         $db->setQuery($sql);
         $db->query();
     }
 }
Example #9
0
 function getCartItem()
 {
     $cid = JRequest::getVar('cid', -1);
     $qty = JRequest::getVar('quantity' . $cid, 1);
     $db = JFactory::getDBO();
     if ($cid > 0) {
         $cart = $this->_model;
         $customer = $this->_customer;
         $configs = $this->_config;
         $sid = $this->_customer->_sid;
         $sql = "UPDATE #__digicom_cart SET quantity = " . $qty . " where cid=" . $cid;
         // sid = " . $sid . " and
         $db->setQuery($sql);
         $db->query();
         // get product id
         $sql = "select item_id from #__digicom_cart where cid = " . $cid . " and sid = " . $sid;
         $db->setQuery($sql);
         $pid = (int) $db->loadResult();
         $items = $cart->getCartItems($customer, $configs);
         $result = array();
         foreach ($items as $key => $item) {
             if ($key < 0) {
                 continue;
             }
             if ($item->cid == $cid) {
                 $result['cid'] = $cid;
                 $result['cart_item_qty' . $cid] = $item->quantity;
                 $result['cart_item_price' . $cid] = DigiComSiteHelperDigiCom::format_price($item->price, $item->currency, true, $configs);
                 $result['cart_item_discount' . $cid] = DigiComSiteHelperDigiCom::format_price($item->discount, $item->currency, true, $configs);
                 $result['cart_item_total' . $cid] = DigiComSiteHelperDigiCom::format_price($item->subtotal - $item->discount, $item->currency, true, $configs);
             }
         }
         //print_r($items);die;
         $total = DigiComSiteHelperDigiCom::format_price($items[-2]['taxed'], $items[-2]['currency'], true, $configs);
         $result['cart_total'] = $total;
         //"{$items[-2]['taxed']}";
         $cart = $this->_model;
         $cart_tax = $cart->calc_price($items, $customer, $configs);
         $result['cart_discount'] = DigiComSiteHelperDigiCom::format_price($cart_tax["promo"], $items[-2]['currency'], true, $configs);
         $result['cart_tax'] = DigiComSiteHelperDigiCom::format_price($cart_tax["value"], $items[-2]['currency'], true, $configs);
         echo json_encode($result);
     } else {
         echo json_encode(array());
     }
     exit;
 }
Example #10
0
				<b><?php 
$text = "COM_DIGICOM_ITEM_IN_CART";
if ($k > 1) {
    $text = "COM_DIGICOM_ITEMS_IN_CART";
}
echo $k . " " . JText::_($text);
?>
</b>
			</td>
			<td><b><?php 
echo JText::_("COM_DIGICOM_SUBTOTAL");
?>
</b></td>
			<td>
				<b><?php 
echo DigiComSiteHelperDigiCom::format_price2($total, $currency, true, $configs);
?>
</b>
			</td>
		</tr>
		</tfoot>
	</table>

	<input name="controller" type="hidden" id="controller" value="Cart">
	<input name="task" type="hidden" id="task" value="updateCart">
	<input name="returnpage" type="hidden" id="returnpage" value="">
	<input name="Itemid" type="hidden" value="<?php 
global $Itemid;
echo $Itemid;
?>
">
Example #11
0
 function getlistDownloads_x()
 {
     $user = new DigiComSiteHelperSession();
     //dsdebug($user->_customer->id);die;
     $db = JFactory::getDBO();
     $search = JRequest::getVar('search', '');
     $search = trim($search);
     if (empty($this->_products)) {
         $query = $db->getQuery(true);
         $query->select('DISTINCT(' . $db->quoteName('od.productid') . ')');
         $query->select($db->quoteName(array('p.name', 'p.catid', 'p.bundle_source')));
         $query->select($db->quoteName('od.package_type') . ' type');
         $query->from($db->quoteName('#__digicom_products') . ' p');
         $query->from($db->quoteName('#__digicom_orders_details') . ' od');
         $query->where($db->quoteName('od.userid') . ' = ' . $db->quote($user->_customer->id));
         $query->where($db->quoteName('od.productid') . ' = ' . $db->quoteName('p.id'));
         $query->where($db->quoteName('od.published') . ' = ' . $db->quote('1'));
         $query->order('ordering ASC');
         // Reset the query using our newly populated query object.
         $db->setQuery($query);
         $products = $db->loadObjectList();
         $bundleItems = array();
         foreach ($products as $key => $product) {
             if ($product->type != 'reguler') {
                 switch ($product->type) {
                     case 'category':
                         //echo 'product type category, solve it man';die;
                         //as its a category type product, remove this key;
                         // add products to this $products object
                         $BundleTable = JTable::getInstance('Bundle', 'Table');
                         $BundleList = $BundleTable->getFieldValues('product_id', $product->productid, $product->bundle_source);
                         $bundle_ids = $BundleList->bundle_id;
                         if ($bundle_ids) {
                             $db = $this->getDbo();
                             $query = $db->getQuery(true)->select(array('id as productid', 'name', 'catid'))->from($db->quoteName('#__digicom_products'))->where($db->quoteName('bundle_source') . ' IS NULL')->where($db->quoteName('catid') . ' in (' . $bundle_ids . ')');
                             $db->setQuery($query);
                             $bundleItems[] = $db->loadObjectList();
                             //we should show only items
                         }
                         unset($products[$key]);
                         break;
                     case 'product':
                     default:
                         $BundleTable = JTable::getInstance('Bundle', 'Table');
                         $BundleList = $BundleTable->getFieldValues('product_id', $product->productid, $product->bundle_source);
                         $bundle_ids = $BundleList->bundle_id;
                         if ($bundle_ids) {
                             $db = $this->getDbo();
                             $query = $db->getQuery(true)->select(array('id as productid', 'name', 'catid'))->from($db->quoteName('#__digicom_products'))->where($db->quoteName('bundle_source') . ' IS NULL')->where($db->quoteName('id') . ' in (' . $bundle_ids . ')');
                             $db->setQuery($query);
                             $bundleItems[] = $db->loadObjectList();
                         }
                         //we should show only items
                         unset($products[$key]);
                         break;
                 }
             }
         }
         //print_r($bundleItems);die;
         //we got all our products
         // now add bundle item to the products array
         if (count($bundleItems) > 0) {
             foreach ($bundleItems as $item2) {
                 foreach ($item2 as $item3) {
                     $products[] = $item3;
                 }
             }
         }
         //print_r($products);die;
         $productAdded = array();
         foreach ($products as $key => $product) {
             $query = $db->getQuery(true);
             $query->select($db->quoteName(array('id', 'name', 'url', 'hits')));
             $query->from($db->quoteName('#__digicom_products_files'));
             $query->where($db->quoteName('product_id') . ' = ' . $db->quote($product->productid));
             $query->order('id DESC');
             // Reset the query using our newly populated query object.
             $db->setQuery($query);
             $files = $db->loadObjectList();
             if (count($files) > 0) {
                 foreach ($files as $key2 => $item) {
                     $downloadid = array('fileid' => $item->id);
                     $downloadcode = json_encode($downloadid);
                     $item->downloadid = base64_encode($downloadcode);
                     $parsed = parse_url($item->url);
                     if (empty($parsed['scheme'])) {
                         $fileLink = JPATH_BASE . DIRECTORY_SEPARATOR . $item->url;
                     } else {
                         $fileLink = $item->url;
                     }
                     if (JFile::exists($fileLink)) {
                         $filesize = filesize($fileLink);
                         $item->filesize = DigiComSiteHelperDigiCom::FileSizeConvert($filesize);
                         $item->filemtime = date("d F Y", filemtime($fileLink));
                     } else {
                         $item->filesize = JText::_('COM_DIGICOM_FILE_DOESNT_EXIST');
                         $item->filemtime = JText::_('COM_DIGICOM_FILE_DOESNT_EXIST');
                     }
                 }
             }
             $product->files = $files;
             if (isset($productAdded[$product->productid])) {
                 unset($products[$key]);
             }
             $productAdded[$product->productid] = true;
         }
         $this->_products = $products;
     }
     return $this->_products;
 }
Example #12
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $app = JFactory::getApplication();
     $input = $app->input;
     $customer = new DigiComSiteHelperSession();
     if ($customer->_user->id > 0) {
         $Itemid = $input->get("Itemid", 0);
         $app->Redirect(JRoute::_('index.php?option=com_digicom&view=dashboard&Itemid=' . $Itemid, false));
         return true;
     }
     $this->askforbilling = $configs->get('askforbilling', 1);
     $this->askforcompany = $configs->get('askforcompany', 1);
     $country_option = DigiComSiteHelperDigiCom::get_country_options($customer, false, $configs);
     $lists['country_option'] = $country_option;
     $profile = new StdClass();
     $profile->country = @$customer->country;
     $profile->state = @$customer->state;
     $shipcountry_option = DigiComSiteHelperDigiCom::get_country_options($profile, true, $configs);
     $lists['shipcountry_options'] = $shipcountry_option;
     $lists['customerlocation'] = DigiComSiteHelperDigiCom::get_store_province($profile, false);
     $profile = new StdClass();
     $profile->country = @$customer->country;
     $profile->state = @$customer->state;
     $lists['customershippinglocation'] = DigiComSiteHelperDigiCom::get_store_province($profile, true);
     $sql = "select * from #__digicom_states where eumember='1'";
     $db->setQuery($sql);
     $eucs = $db->loadObjectList();
     $eu = array();
     foreach ($eucs as $euc) {
         $eu[] = $euc->country;
     }
     $this->assign("eu", $eu);
     $eulocated = isset($customer->country) && in_array($customer->country, $eu);
     $this->assign("eulocated", $eulocated);
     $cclasses = @explode("\n", $customer->taxclass);
     $data = $this->get('listCustomerClasses');
     $select = '<select name="taxclass" >';
     if (count($data) > 0) {
         foreach ($data as $i => $v) {
             $select .= '<option value="' . $v->id . '" ';
             if (in_array($v->id, $cclasses)) {
                 $select .= ' selected ';
             }
             $select .= ' > ' . $v->name . '</option>';
         }
     }
     $select .= '</select>';
     $lists['customer_class'] = $select;
     $this->assign("lists", $lists);
     $this->assign("customer", $customer);
     $this->assign("configs", $configs);
     //prepare default and tmp value
     $old_values = array();
     if (isset($_SESSION["new_customer"])) {
         $old_values = $_SESSION["new_customer"];
     }
     $userinfo = new StdClass();
     $userinfo->firstname = "";
     $userinfo->lastname = "";
     $userinfo->company = "";
     $userinfo->email = "";
     $userinfo->username = "";
     $userinfo->password = "";
     $userinfo->password_confirm = "";
     $userinfo->address = "";
     $userinfo->city = "";
     $userinfo->zipcode = "";
     $userinfo->country = "";
     $userinfo->state = "";
     if (isset($old_values) && count($old_values) > 0) {
         $userinfo->firstname = $old_values["firstname"];
         $userinfo->lastname = $old_values["lastname"];
         $userinfo->company = $old_values["company"];
         $userinfo->email = $old_values["email"];
         $userinfo->username = $old_values["username"];
         $userinfo->password = $old_values["password"];
         $userinfo->password_confirm = $old_values["password_confirm"];
         $userinfo->address = $old_values["address"];
         $userinfo->city = $old_values["city"];
         $userinfo->zipcode = $old_values["zipcode"];
         $userinfo->country = $old_values["country"];
         $userinfo->state = $old_values["state"];
         unset($_SESSION["new_customer"]);
     }
     $this->assign("userinfo", $userinfo);
     $layout = $input->get('layout', 'register');
     $template = new DigiComSiteHelperTemplate($this);
     $template->rander($layout);
     parent::display($tpl);
 }
Example #13
0
    public function getOrderItems($order_id)
    {
        $configs = $this->configs;
        $customer = new DigiComSiteHelperSession();
        $db = JFactory::getDbo();
        $sql = 'SELECT `p`.*, `od`.quantity FROM
					`#__digicom_products` AS `p`
						INNER JOIN
					`#__digicom_orders_details` AS `od` ON (`od`.`productid` = `p`.`id`)
				WHERE `orderid` =' . $order_id;
        $db->setQuery($sql);
        $items = $db->loadObjectList();
        //change the price of items if needed
        for ($i = 0; $i < count($items); $i++) {
            $item =& $items[$i];
            $item->discount = 0;
            $item->currency = $configs->get('currency', 'USD');
            $item->price = DigiComSiteHelperDigiCom::format_price($item->price, $item->currency, false, $configs);
            //sprintf( $price_format, $item->product_price );
            $item->subtotal = DigiComSiteHelperDigiCom::format_price($item->price, $item->currency, false, $configs);
            //sprintf( $price_format, $item->subtotal );
            $item->price_formated = DigiComSiteHelperDigiCom::format_price2($item->price, $item->currency, false, $configs);
            //sprintf( $price_format, $item->product_price );
            $item->subtotal_formated = DigiComSiteHelperDigiCom::format_price2($item->subtotal, $item->currency, false, $configs);
            //sprintf( $price_format, $item->subtotal );
            $item->subtotal = $item->price * $item->quantity;
        }
        return $items;
    }
Example #14
0
echo JText::_('PLG_DIGICOM_PAY_OFFLINE_ORDER_INFORMATION_LABEL');
?>
</label>
			<div class="controls">	<?php 
echo JText::sprintf('PLG_DIGICOM_PAY_OFFLINE_ORDER_INFO', $vars->custom_name);
?>
</div>
		</div>

		<div class="control-group">
			<label for="cardlname" class="control-label"><?php 
echo JText::_('PLG_DIGICOM_PAY_OFFLINE_PAYABLE_AMOUNT');
?>
</label>
			<div class="controls"><span class="label label-success"><?php 
echo DigiComSiteHelperDigiCom::format_price($vars->amount, $configs->get('currency', 'USD'), true, $configs);
?>
</span></div>
		</div>
	
		<div class="control-group">
			<label for="cardlname" class="control-label"><?php 
echo JText::_('PLG_DIGICOM_PAY_OFFLINE_COMMENT');
?>
</label>
			<div class="controls"><textarea id='comment' name='comment' class="inputbox required" rows='3' maxlength='135' size='28'></textarea></div>
		</div>

		<div class="control-group">
			<label for="cardaddress1" class="control-label"><?php 
echo JText::_('PLG_DIGICOM_PAY_OFFLINE_AFTER_PAYMENT_CONTACT_LABEL');
Example #15
0
 function affiliate($total, $orderid, $configs)
 {
     $mosConfig_live_site = DigiComSiteHelperDigiCom::getLiveSite();
     $my = JFactory::getUser();
     if ($configs->get('idevaff', 'notapplied') == 'notapplied') {
         return;
     }
     @session_start();
     $idev_psystems_1 = $total;
     $idev_psystems_2 = $orderid;
     $name = "iJoomla Products";
     $email = $my->email;
     //"*****@*****.**";
     $item_number = 1;
     $ip_address = $_SERVER['REMOTE_ADDR'];
     if ($configs->get('idevaff', 'notapplied') == 'standalone' && file_exists(JPATH_SITE . "/" . $configs->get('idevpath', 'notapplied') . "/sale.php")) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $mosConfig_live_site . "/" . $configs->get('idevpath', 'notapplied') . "/sale.php?profile=72198&idev_saleamt=" . $total . "&idev_ordernum=" . $orderid . "&ip_address=" . $ip_address);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_exec($ch);
         curl_close($ch);
     } else {
         if ($configs->get('idevaff', 'notapplied') == 'component') {
             $orderidvar = $configs->get('orderidvar', '');
             $ordersubtotvar = $configs->get('ordersubtotalvar', '');
             echo '<img border="0" src="' . $mosConfig_live_site . '/components/com_idevaffiliate/sale.php?' . $ordersubtotvar . '=' . sprintf("%.2f", $total) . '&' . $orderidvar . '=' . $orderid . '" width="1" height="1">';
         }
     }
 }
Example #16
0
		</tbody>
	</table>


	<a href="<?php 
echo JRoute::_("index.php?option=com_digicom&view=downloads");
?>
" class="btn btn-success">
		<i class="icon-out"></i><?php 
echo JText::_('COM_DIGICOM_GO_DOWNLOAD');
?>
	</a>

	<a class="btn btn-info" target="_blank" href="<?php 
echo JRoute::_("index.php?option=com_digicom&view=order&layout=invoice&id=" . $order->id . "&tmpl=component");
?>
">
		<i class="icon-printer"></i> <?php 
echo JText::_('COM_DIGICOM_ORDER_PRINT');
?>
	</a>

	<?php 
DigiComSiteHelperDigicom::loadModules('digicom_footer', 'xhtml');
?>

</div>

<?php 
echo DigiComSiteHelperDigiCom::powered_by();
Example #17
0
        ?>

			<?php 
        // TODO : remove this after issue #52 solve. no false index should be on cart array
        if ($index < 0) {
            continue;
        }
        ?>

			<li class="clearfix">
				<a href="<?php 
        echo JRoute::_(DigiComHelperRoute::getProductRoute($item->id, $item->catid));
        ?>
">
					<img src="<?php 
        echo DigiComSiteHelperDigiCom::getThumbnail($item->images);
        ?>
" alt="<?php 
        echo $item->name;
        ?>
"/>
					<?php 
        echo $item->name;
        ?>
				</a>
				<span class="dg-quantity">
					<?php 
        echo $item->quantity;
        ?>
 x <?php 
        echo $item->price;