Esempio n. 1
0
function display_products($rows)
{
    $url = JURI::base();
    $extra_data = new producthelper();
    $producthelper = new producthelper();
    for ($i = 0; $i < count($rows); $i++) {
        $row = $rows[$i];
        $Itemid = $this->redHelper->getItemid($row->product_id);
        $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid);
        $product_price = $producthelper->getProductPrice($row->product_id);
        $productArr = $producthelper->getProductNetPrice($row->product_id);
        $product_price_discount = $productArr['productPrice'] + $productArr['productVat'];
        if ($row->product_full_image) {
            echo $thum_image = "<div class='mod_wishlist_product_image' >" . ($thum_image = $producthelper->getProductImage($row->product_id, $link, "100", "100") . "\n\t\t\t</div>");
        }
        echo "<a href='" . $link . "'>" . $row->product_name . "</a><br>";
        if ($row->product_on_sale && $product_price_discount > 0) {
            if ($product_price > $product_price_discount) {
                $s_price = $product_price - $product_price_discount;
                if ($this->show_discountpricelayout) {
                    echo "<div id='mod_redoldprice' class='mod_redoldprice'><span style='text-decoration:line-through;'>" . $producthelper->getProductFormattedPrice($product_price) . "</span></div>";
                    $product_price = $product_price_discount;
                    echo "<div id='mod_redmainprice' class='mod_redmainprice'>" . $producthelper->getProductFormattedPrice($product_price_discount) . "</div>";
                    echo "<div id='mod_redsavedprice' class='mod_redsavedprice'>" . JText::_('COM_REDSHOP_PRODCUT_PRICE_YOU_SAVED') . ' ' . $producthelper->getProductFormattedPrice($s_price) . "</div>";
                } else {
                    $product_price = $product_price_discount;
                    echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
                }
            } else {
                echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
            }
        } else {
            echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
        }
        echo "<br><a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>&nbsp;";
        echo $addtocartdata = $producthelper->replaceCartTemplate($row->product_id);
        echo "<div>" . $addtocartdata . "</div>";
    }
}
Esempio n. 2
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/configuration.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/template.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/stockroom.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/economic.php';
     require_once JPATH_SITE . '/components/com_redshop/helpers/product.php';
     $Redconfiguration = new Redconfiguration();
     $data = array();
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('redshopproductssourcecategory', '')));
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'pr_cat.category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('redshopproductssourcepublished', 1)) {
         $where[] = ' pr.published = 1 ';
     }
     if ($this->_data->get('redshopproductssourcespecial', 0)) {
         $where[] = ' (pr.product_special =  1) ';
     }
     if ($this->_data->get('redshopproductssourceonsale', 0)) {
         $where[] = ' (pr.product_on_sale =  1) ';
     }
     $o = '';
     $order = NextendParse::parse($this->_data->get('redshopproductsorder1', 'pr.product_name|*|asc'));
     if ($order[0]) {
         $o .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('redshopproductsorder2', 'pr.product_name|*|asc'));
         if ($order[0]) {
             $o .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query = "SELECT \r\n                        pr.product_id, \r\n                        pr.published, \r\n                        pr_cat.ordering, \r\n                        pr.product_name as name, \r\n                        pr.product_s_desc as short_description, \r\n                        pr.product_desc as description, \r\n                        man.manufacturer_name as man_name,\r\n                        pr.product_full_image as image, \r\n                        pr.product_thumb_image as image_thumbnail, \r\n                        pr.product_price,\r\n                        cat.category_id,\r\n                        cat.category_name, \r\n                        cat.category_short_description , \r\n                        cat.category_description\r\n                    FROM `#__redshop_product` AS pr\r\n                    LEFT JOIN `#__redshop_product_category_xref` AS pr_cat USING (product_id)\r\n                    LEFT JOIN `#__redshop_category` AS cat USING (category_id)\r\n                    LEFT JOIN `#__redshop_manufacturer` AS man USING(manufacturer_id)\r\n                    WHERE pr.product_parent_id=0 " . (count($where) ? ' AND ' . implode(' AND ', $where) : '') . " " . $o . " LIMIT 0, " . $number;
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $uri = str_replace(array('http://', 'https://'), '//', NextendUri::getBaseUri());
     for ($i = 0; $i < count($result); $i++) {
         $product = new producthelper();
         $result[$i]['title'] = $result[$i]['name'];
         $result[$i]['price'] = $product->getProductFormattedPrice($product->getProductPrice($result[$i]['product_id']));
         $result[$i]['addtocart'] = $result[$i]['url'] = 'index.php?option=com_redshop&view=product&pid=' . $result[$i]['product_id'] . '&cid=' . $result[$i]['category_id'];
         $result[$i]['addtocart_label'] = 'View product';
         $result[$i]['category_url'] = 'index.php?option=com_redshop&view=category&cid=' . $result[$i]['category_id'] . '&layout=detail';
         $result[$i]['thumbnail'] = $result[$i]['image_thumbnail'] = $uri . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $result[$i]['image_thumbnail'];
         $result[$i]['image'] = $uri . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $result[$i]['image'];
     }
     return $result;
 }
Esempio n. 3
0
 public function newsletterEntry($cid = array(), $userid = array(), $username = array())
 {
     $producthelper = new producthelper();
     $jconfig = new jconfig();
     $db = JFactory::getDbo();
     $newsletter_id = JRequest::getVar('newsletter_id');
     $uri = JURI::getInstance();
     $url = $uri->root();
     $mailfrom = $jconfig->mailfrom;
     $fromname = $jconfig->fromname;
     if (NEWS_MAIL_FROM != "") {
         $mailfrom = NEWS_MAIL_FROM;
     }
     if (NEWS_FROM_NAME != "") {
         $fromname = NEWS_FROM_NAME;
     }
     // Getting newsletter content
     $newsbody = $this->getnewsletter_content($newsletter_id);
     $subject = "";
     $newsletter_body = "";
     $newsletter_template = "";
     if (count($newsbody) > 0) {
         $subject = $newsbody[0]->subject;
         $newsletter_body = $newsbody[0]->body;
         $newsletter_template = $newsbody[0]->template_desc;
     }
     $o = new stdClass();
     $o->text = $newsletter_body;
     JPluginHelper::importPlugin('content');
     $dispatcher = JDispatcher::getInstance();
     $x = array();
     $results = $dispatcher->trigger('onPrepareContent', array(&$o, &$x, 1));
     $newsletter_template2 = $o->text;
     $content = str_replace("{data}", $newsletter_template2, $newsletter_template);
     $product_id_list = $this->getProductIdList();
     for ($i = 0; $i < count($product_id_list); $i++) {
         $product_id = $product_id_list[$i]->product_id;
         if (strstr($content, '{redshop:' . $product_id . '}')) {
             $content = str_replace('{redshop:' . $product_id . '}', "", $content);
         }
         if (strstr($content, '{Newsletter Products:' . $product_id . '}')) {
             $product_id = $product_id_list[$i]->product_id;
             $newsproductbody = $this->getnewsletterproducts_content();
             $np_temp_desc = $newsproductbody[0]->template_desc;
             $thum_image = "";
             if ($product_id_list[$i]->product_full_image) {
                 $thumbUrl = RedShopHelperImages::getImagePath($product_id_list[$i]->product_full_image, '', 'thumb', 'product', PRODUCT_MAIN_IMAGE, PRODUCT_MAIN_IMAGE, USE_IMAGE_SIZE_SWAPPING);
                 $thum_image = "<a id='a_main_image' href='" . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $product_id_list[$i]->product_full_image . "' title='' rel=\"lightbox[product7]\">";
                 $thum_image .= "<img id='main_image' src='" . $thumbUrl . "'>";
                 $thum_image .= "</a>";
             }
             $np_temp_desc = str_replace("{product_thumb_image}", $thum_image, $np_temp_desc);
             $np_temp_desc = str_replace("{product_price}", $producthelper->getProductFormattedPrice($product_id_list[$i]->product_price), $np_temp_desc);
             $np_temp_desc = str_replace("{product_name}", $product_id_list[$i]->product_name, $np_temp_desc);
             $np_temp_desc = str_replace("{product_desc}", $product_id_list[$i]->product_desc, $np_temp_desc);
             $np_temp_desc = str_replace("{product_s_desc}", $product_id_list[$i]->product_s_desc, $np_temp_desc);
             $content = str_replace("{Newsletter Products:" . $product_id . "}", $np_temp_desc, $content);
         }
     }
     // Replacing the Text library texts
     $texts = new text_library();
     $content = $texts->replace_texts($content);
     // If the template contains the images, then revising the path of the images,
     // So the full URL goes with the mail, so images are visible in the mails.
     $data1 = $data = $content;
     preg_match_all("/\\< *[img][^\\>]*[.]*\\>/i", $data, $matches);
     $imagescurarray = array();
     foreach ($matches[0] as $match) {
         preg_match_all("/(src|height|width)*= *[\"\\']{0,1}([^\"\\'\\ \\>]*)/i", $match, $m);
         $images[] = array_combine($m[1], $m[2]);
         $imagescur = array_combine($m[1], $m[2]);
         $imagescurarray[] = $imagescur['src'];
     }
     $imagescurarray = array_unique($imagescurarray);
     if ($imagescurarray) {
         foreach ($imagescurarray as $change) {
             if (strpos($change, 'http') === false) {
                 $data1 = str_replace($change, $url . $change, $data1);
             }
         }
     }
     $retsubscriberid = array();
     for ($j = 0; $j < count($cid); $j++) {
         $subscriberinfo = $this->subscribersinfo($cid[$j]);
         if (count($subscriberinfo) > 0) {
             $today = time();
             $subscribe_email = trim($subscriberinfo[0]->email);
             $unsub_link = $url . 'index.php?option=com_redshop&view=newsletter&task=unsubscribe&email1=' . $subscribe_email;
             $query = "INSERT INTO `" . $this->_table_prefix . "newsletter_tracker` " . "(`tracker_id`, `newsletter_id`, `subscription_id`, `subscriber_name`, `user_id` , `read`, `date`)  " . "VALUES ('', '" . $newsletter_id . "', '" . $cid[$j] . "', '" . $username[$j] . "', '" . $userid[$j] . "',0, '" . $today . "')";
             $db->setQuery($query);
             $db->query();
             $content = '<img  src="' . $url . 'components/com_redshop/helpers/newsletteropener.php?tracker_id=' . $db->insertid() . '" style="display:none;" />';
             // Replacing the tags with the values
             $content .= str_replace("{username}", $subscriberinfo[0]->username, $data1);
             $content = str_replace("{email}", $subscribe_email, $content);
             $unsubscriberlink = "<a href='" . $unsub_link . "'>" . JText::_('COM_REDSHOP_UNSUBSCRIBE') . "</a>";
             $content = str_replace("{unsubscribe_link}", $unsubscriberlink, $content);
             $message = $content;
             if ($subscribe_email != "") {
                 if (JUtility::sendMail($mailfrom, $fromname, $subscribe_email, $subject, $message, 1)) {
                     $retsubscriberid[$j] = 1;
                 } else {
                     $retsubscriberid[$j] = 0;
                 }
             }
         }
     }
     return $retsubscriberid;
 }
Esempio n. 4
0
        $template_edata = explode('{product_loop_end}', $template_sdata[1]);
        if (count($template_edata) > 1) {
            $template_end = $template_edata[1];
            $template_middle = $template_edata[0];
        }
    }
}
$cart_mdata = '';
$subtotal_excl_vat = 0;
for ($i = 0; $i < count($quotationProducts); $i++) {
    $cart_mdata .= $template_middle;
    $wrapper_name = "";
    if ($quotationProducts[$i]->product_wrapperid) {
        $wrapper = $producthelper->getWrapper($quotationProducts[$i]->product_id, $quotationProducts[$i]->product_wrapperid);
        if (count($wrapper) > 0) {
            $wrapper_name = JText::_('COM_REDSHOP_WRAPPER') . ":<br/>" . $wrapper[0]->wrapper_name . "(" . $producthelper->getProductFormattedPrice($quotationProducts[$i]->wrapper_price) . ")";
        }
    }
    if ($quotationProducts[$i]->is_giftcard == 1) {
        $product_userfields = $quotationHelper->displayQuotationUserfield($quotationProducts[$i]->quotation_item_id, 13);
        $giftcardData = $producthelper->getGiftcardData($quotationProducts[$i]->product_id);
        $product_number = "";
    } else {
        $product_userfields = $quotationHelper->displayQuotationUserfield($quotationProducts[$i]->quotation_item_id, 12);
        $product = $producthelper->getProductById($quotationProducts[$i]->product_id);
        $product_number = $product->product_number;
        $product_image_path = "";
        if ($product->product_full_image) {
            if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $product->product_full_image)) {
                $product_image_path = $product->product_full_image;
            } else {
Esempio n. 5
0
					</td>
					<td align="center"><?php 
    echo $row->shopper_group_name;
    ?>
</td>
					<td align="center"><?php 
    echo $row->price_quantity_start;
    ?>
</td>
					<td align="center"><?php 
    echo $row->price_quantity_end;
    ?>
</td>
					<td align="center"
					    width="5%"><?php 
    echo $producthelper->getProductFormattedPrice($row->product_price);
    ?>
</td>
					<td align="center"
					    width="5%"><?php 
    echo $producthelper->getProductFormattedPrice($row->discount_price);
    ?>
</td>
				</tr>
				<?php 
    $k = 1 - $k;
}
?>
			<tfoot>
			<td colspan="8"><?php 
echo $this->pagination->getListFooter();
 public function store($postdata)
 {
     $redshopMail = new redshopMail();
     $order_functions = new order_functions();
     $helper = new redhelper();
     $producthelper = new producthelper();
     $rsCarthelper = new rsCarthelper();
     $shippinghelper = new shipping();
     $adminproducthelper = new adminproducthelper();
     $stockroomhelper = new rsstockroomhelper();
     // For barcode generation
     $barcode_code = $order_functions->barcode_randon_number(12, 0);
     $postdata['barcode'] = $barcode_code;
     $row = $this->getTable('order_detail');
     if (!$row->bind($postdata)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $iscrm = $helper->isredCRM();
     if ($iscrm) {
         $postdata['order_id'] = $row->order_id;
         $postdata['debitor_id'] = $postdata['user_info_id'];
         JTable::addIncludePath(REDCRM_ADMIN . '/tables');
         $crmorder =& $this->getTable('crm_order');
         if (!$crmorder->bind($postdata)) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         if (!$crmorder->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // Update rma table entry
         if (ENABLE_RMA && isset($postdata['rmanotes'])) {
             $rmaInfo = $this->getTable('rma_orders');
             $rmaInfo->rma_number = $postdata['rma_number'];
             $rmaInfo->original_order_id = $postdata['main_order_id'];
             $rmaInfo->credit_note_order_id = $row->order_id;
             $rmaInfo->rma_note = $postdata['rmanotes'];
             $rmaInfo->store();
         }
         JTable::addIncludePath(REDSHOP_ADMIN . '/tables');
     }
     $order_shipping = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $row->ship_method_id)));
     $rowOrderStatus =& $this->getTable('order_status_log');
     $rowOrderStatus->order_id = $row->order_id;
     $rowOrderStatus->order_status = $row->order_status;
     $rowOrderStatus->date_changed = time();
     $rowOrderStatus->customer_note = $row->customer_note;
     $rowOrderStatus->store();
     $billingaddresses = $order_functions->getBillingAddress($row->user_id);
     if (isset($postdata['billisship']) && $postdata['billisship'] == 1) {
         $shippingaddresses = $billingaddresses;
     } else {
         $key = 0;
         $shippingaddresses = $order_functions->getShippingAddress($row->user_id);
         $shipp_users_info_id = isset($postdata['shipp_users_info_id']) && $postdata['shipp_users_info_id'] != 0 ? $postdata['shipp_users_info_id'] : 0;
         if ($shipp_users_info_id != 0) {
             for ($o = 0; $o < count($shippingaddresses); $o++) {
                 if ($shippingaddresses[$o]->users_info_id == $shipp_users_info_id) {
                     $key = $o;
                     break;
                 }
             }
         }
         $shippingaddresses = $shippingaddresses[$key];
     }
     // ORDER DELIVERY TIME IS REMAINING
     $user_id = $row->user_id;
     $item = $postdata['order_item'];
     for ($i = 0; $i < count($item); $i++) {
         $product_id = $item[$i]->product_id;
         $quantity = $item[$i]->quantity;
         $product_excl_price = $item[$i]->prdexclprice;
         $product_price = $item[$i]->productprice;
         // Attribute price added
         $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
         $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
         $product_attribute = $retAttArr[0];
         // Accessory price
         $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
         $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
         $product_accessory = $retAccArr[0];
         $accessory_total_price = $retAccArr[1];
         $accessory_vat_price = $retAccArr[2];
         $wrapper_price = 0;
         $wrapper_vat = 0;
         if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') {
             $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
             if (count($wrapper) > 0) {
                 if ($wrapper[0]->wrapper_price > 0) {
                     $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
                 }
                 $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
             }
         }
         $product = $producthelper->getProductById($product_id);
         $rowitem =& $this->getTable('order_item_detail');
         if (!$rowitem->bind($postdata)) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // STOCKROOM update
         $updatestock = $stockroomhelper->updateStockroomQuantity($product_id, $quantity);
         $stockroom_id_list = $updatestock['stockroom_list'];
         $stockroom_quantity_list = $updatestock['stockroom_quantity_list'];
         $rowitem->stockroom_id = $stockroom_id_list;
         $rowitem->stockroom_quantity = $stockroom_quantity_list;
         $rowitem->order_item_id = 0;
         $rowitem->order_id = $row->order_id;
         $rowitem->user_info_id = $row->user_info_id;
         $rowitem->supplier_id = $product->manufacturer_id;
         $rowitem->product_id = $product_id;
         $rowitem->order_item_sku = $product->product_number;
         $rowitem->order_item_name = $product->product_name;
         $rowitem->product_quantity = $quantity;
         $rowitem->product_item_price = $product_price;
         $rowitem->product_item_price_excl_vat = $product_excl_price;
         $rowitem->product_final_price = $product_price * $quantity;
         $rowitem->order_item_currency = REDCURRENCY_SYMBOL;
         $rowitem->order_status = $row->order_status;
         $rowitem->cdate = $row->cdate;
         $rowitem->mdate = $row->cdate;
         $rowitem->product_attribute = $product_attribute;
         $rowitem->product_accessory = $product_accessory;
         $rowitem->wrapper_id = $item[$i]->wrapper_data;
         $rowitem->wrapper_price = $wrapper_price;
         $rowitem->is_giftcard = 0;
         // RedCRM product purchase price
         if ($iscrm) {
             $crmProductHelper = new crmProductHelper();
             $crmproduct = $crmProductHelper->getProductById($product_id);
             $rowitem->product_purchase_price = $crmproduct->product_purchase_price > 0 ? $crmproduct->product_purchase_price : $crmproduct->product_price;
         }
         if ($producthelper->checkProductDownload($product_id)) {
             $medianame = $producthelper->getProductMediaName($product_id);
             for ($j = 0; $j < count($medianame); $j++) {
                 $product_serial_number = $producthelper->getProdcutSerialNumber($product_id);
                 $producthelper->insertProductDownload($product_id, $user_id, $rowitem->order_id, $medianame[$j]->media_name, $product_serial_number->serial_number);
             }
         }
         if (!$rowitem->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         /** my accessory save in table start */
         if (count($generateAccessoryCart) > 0) {
             $attArr = $generateAccessoryCart;
             for ($a = 0; $a < count($attArr); $a++) {
                 $accessory_vat_price = 0;
                 $accessory_attribute = "";
                 $accessory_id = $attArr[$a]['accessory_id'];
                 $accessory_name = $attArr[$a]['accessory_name'];
                 $accessory_price = $attArr[$a]['accessory_price'];
                 $accessory_org_price = $accessory_price;
                 if ($accessory_price > 0) {
                     $accessory_vat_price = $producthelper->getProductTax($product_id, $accessory_price, $user_id);
                 }
                 $attchildArr = $attArr[$a]['accessory_childs'];
                 for ($j = 0; $j < count($attchildArr); $j++) {
                     $attribute_id = $attchildArr[$j]['attribute_id'];
                     $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>";
                     $rowattitem =& $this->getTable('order_attribute_item');
                     $rowattitem->order_att_item_id = 0;
                     $rowattitem->order_item_id = $rowitem->order_item_id;
                     $rowattitem->section_id = $attribute_id;
                     $rowattitem->section = "attribute";
                     $rowattitem->parent_section_id = $accessory_id;
                     $rowattitem->section_name = $attchildArr[$j]['attribute_name'];
                     $rowattitem->is_accessory_att = 1;
                     if ($attribute_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $propArr = $attchildArr[$j]['attribute_childs'];
                     for ($k = 0; $k < count($propArr); $k++) {
                         $section_vat = 0;
                         if ($propArr[$k]['property_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $user_id);
                         }
                         $property_id = $propArr[$k]['property_id'];
                         $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>";
                         $subpropArr = $propArr[$k]['property_childs'];
                         $rowattitem =& $this->getTable('order_attribute_item');
                         $rowattitem->order_att_item_id = 0;
                         $rowattitem->order_item_id = $rowitem->order_item_id;
                         $rowattitem->section_id = $property_id;
                         $rowattitem->section = "property";
                         $rowattitem->parent_section_id = $attribute_id;
                         $rowattitem->section_name = $propArr[$k]['property_name'];
                         $rowattitem->section_price = $propArr[$k]['property_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                         $rowattitem->is_accessory_att = 1;
                         if ($property_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                         for ($l = 0; $l < count($subpropArr); $l++) {
                             $section_vat = 0;
                             if ($subpropArr[$l]['subproperty_price'] > 0) {
                                 $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                             }
                             $subproperty_id = $subpropArr[$l]['subproperty_id'];
                             $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>";
                             $rowattitem =& $this->getTable('order_attribute_item');
                             $rowattitem->order_att_item_id = 0;
                             $rowattitem->order_item_id = $rowitem->order_item_id;
                             $rowattitem->section_id = $subproperty_id;
                             $rowattitem->section = "subproperty";
                             $rowattitem->parent_section_id = $property_id;
                             $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                             $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                             $rowattitem->section_vat = $section_vat;
                             $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                             $rowattitem->is_accessory_att = 1;
                             if ($subproperty_id > 0) {
                                 if (!$rowattitem->store()) {
                                     $this->setError($this->_db->getErrorMsg());
                                     return false;
                                 }
                             }
                         }
                     }
                 }
                 $accdata =& $this->getTable('accessory_detail');
                 if ($accessory_id > 0) {
                     $accdata->load($accessory_id);
                 }
                 $accProductinfo = $producthelper->getProductById($accdata->child_product_id);
                 $rowaccitem =& $this->getTable('order_acc_item');
                 $rowaccitem->order_item_acc_id = 0;
                 $rowaccitem->order_item_id = $rowitem->order_item_id;
                 $rowaccitem->product_id = $accessory_id;
                 $rowaccitem->order_acc_item_sku = $accProductinfo->product_number;
                 $rowaccitem->order_acc_item_name = $accessory_name;
                 $rowaccitem->order_acc_price = $accessory_org_price;
                 $rowaccitem->order_acc_vat = $accessory_vat_price;
                 $rowaccitem->product_quantity = $quantity;
                 $rowaccitem->product_acc_item_price = $accessory_price;
                 $rowaccitem->product_acc_final_price = $accessory_price * $quantity;
                 $rowaccitem->product_attribute = $accessory_attribute;
                 if ($accessory_id > 0) {
                     if (!$rowaccitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
             }
         }
         /** my attribute save in table start */
         if (count($generateAttributeCart) > 0) {
             $attArr = $generateAttributeCart;
             for ($j = 0; $j < count($attArr); $j++) {
                 $attribute_id = $attArr[$j]['attribute_id'];
                 $rowattitem =& $this->getTable('order_attribute_item');
                 $rowattitem->order_att_item_id = 0;
                 $rowattitem->order_item_id = $rowitem->order_item_id;
                 $rowattitem->section_id = $attribute_id;
                 $rowattitem->section = "attribute";
                 $rowattitem->parent_section_id = $rowitem->product_id;
                 $rowattitem->section_name = $attArr[$j]['attribute_name'];
                 $rowattitem->is_accessory_att = 0;
                 if ($attribute_id > 0) {
                     if (!$rowattitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
                 $propArr = $attArr[$j]['attribute_childs'];
                 for ($k = 0; $k < count($propArr); $k++) {
                     $section_vat = 0;
                     if ($propArr[$k]['property_price'] > 0) {
                         $section_vat = $producthelper->getProducttax($rowitem->product_id, $propArr[$k]['property_price'], $user_id);
                     }
                     $property_id = $propArr[$k]['property_id'];
                     /** product property STOCKROOM update start */
                     $updatestock = $stockroomhelper->updateStockroomQuantity($property_id, $quantity, "property");
                     $rowattitem =& $this->getTable('order_attribute_item');
                     $rowattitem->order_att_item_id = 0;
                     $rowattitem->order_item_id = $rowitem->order_item_id;
                     $rowattitem->section_id = $property_id;
                     $rowattitem->section = "property";
                     $rowattitem->parent_section_id = $attribute_id;
                     $rowattitem->section_name = $propArr[$k]['property_name'];
                     $rowattitem->section_price = $propArr[$k]['property_price'];
                     $rowattitem->section_vat = $section_vat;
                     $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                     $rowattitem->is_accessory_att = 0;
                     if ($property_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $subpropArr = $propArr[$k]['property_childs'];
                     for ($l = 0; $l < count($subpropArr); $l++) {
                         $section_vat = 0;
                         if ($subpropArr[$l]['subproperty_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                         }
                         $subproperty_id = $subpropArr[$l]['subproperty_id'];
                         /** product subproperty STOCKROOM update start */
                         $updatestock = $stockroomhelper->updateStockroomQuantity($subproperty_id, $quantity, "subproperty");
                         $rowattitem =& $this->getTable('order_attribute_item');
                         $rowattitem->order_att_item_id = 0;
                         $rowattitem->order_item_id = $rowitem->order_item_id;
                         $rowattitem->section_id = $subproperty_id;
                         $rowattitem->section = "subproperty";
                         $rowattitem->parent_section_id = $property_id;
                         $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                         $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                         $rowattitem->is_accessory_att = 0;
                         if ($subproperty_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                     }
                 }
             }
         }
         //			$producthelper->insertProdcutUserfield($i,$item,$rowitem->order_item_id,12);
         if (USE_CONTAINER) {
             $producthelper->updateContainerStock($product_id, $quantity, $rowitem->container_id);
         }
         // Store userfields
         $userfields = $item[$i]->extrafieldname;
         $userfields_id = $item[$i]->extrafieldId;
         for ($ui = 0; $ui < count($userfields); $ui++) {
             $adminproducthelper->admin_insertProdcutUserfield($userfields_id[$ui], $rowitem->order_item_id, 12, $userfields[$ui]);
         }
         // redCRM RMA Transaction Entry
         if ($iscrm) {
             if (ENABLE_RMA && $rowitem->product_final_price < 0) {
                 // RMA transation log
                 if (isset($item[$i]->reason)) {
                     $rmaTrans =& $this->getTable('rma_transaction');
                     $rmaTrans->rma_transaction_id = 0;
                     $rmaTrans->rma_number = $postdata['rma_number'];
                     $rmaTrans->order_item_return_id = $rowitem->order_item_id;
                     $rmaTrans->order_item_return_reason = $item[$i]->reason;
                     $rmaTrans->order_item_return_status = $item[$i]->deposition;
                     $rmaTrans->order_item_return_action = $item[$i]->action;
                     $rmaTrans->cdate = time();
                     $rmaTrans->store();
                     if (ENABLE_ITEM_TRACKING_SYSTEM) {
                         // Manage supplier order stock
                         $crmSupplierOrderHelper = new crmSupplierOrderHelper();
                         $senddata['main_order_number'] = $postdata['main_order_number'];
                         $senddata['order_status'] = $row->order_status;
                         $senddata['product_id'] = $rowitem->product_id;
                         $senddata['property_id'] = $property_id;
                         $senddata['subproperty_id'] = $subproperty_id;
                         $senddata['deposition'] = $item[$i]->deposition;
                         $itemqty = $rowitem->product_quantity;
                         for ($r = 0; $r < $itemqty; $r++) {
                             $crmSupplierOrderHelper->manageStockAffectedRMA($senddata);
                         }
                     }
                 }
             }
         }
     }
     $rowpayment =& $this->getTable('order_payment');
     if (!$rowpayment->bind($postdata)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $rowpayment->order_id = $row->order_id;
     $rowpayment->payment_method_id = $postdata['payment_method_class'];
     $rowpayment->order_payment_amount = $row->order_total;
     $rowpayment->order_payment_name = $postdata['order_payment_name'];
     $rowpayment->payment_method_class = $postdata['payment_method_class'];
     if (!$rowpayment->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Add billing Info
     $userrow =& $this->getTable('user_detail');
     $userrow->load($billingaddresses->users_info_id);
     $orderuserrow =& $this->getTable('order_user_detail');
     if (!$orderuserrow->bind($userrow)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $orderuserrow->order_id = $row->order_id;
     $orderuserrow->address_type = 'BT';
     if (!$orderuserrow->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Add shipping Info
     $userrow =& $this->getTable('user_detail');
     if (isset($shippingaddresses->users_info_id)) {
         $userrow->load($shippingaddresses->users_info_id);
     }
     $orderuserrow =& $this->getTable('order_user_detail');
     if (!$orderuserrow->bind($userrow)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $orderuserrow->order_id = $row->order_id;
     $orderuserrow->address_type = 'ST';
     if (!$orderuserrow->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if ($row->order_status == CLICKATELL_ORDER_STATUS) {
         $helper->clickatellSMS($row->order_id);
     }
     // Maintan supplier order stck when item tracking system is enabled
     if ($helper->isredCRM()) {
         if (ENABLE_ITEM_TRACKING_SYSTEM) {
             // Supplier order helper object
             $crmSupplierOrderHelper = new crmSupplierOrderHelper();
             $getStatus = array();
             $getStatus['orderstatus'] = $row->order_status;
             $getStatus['paymentstatus'] = $row->order_payment_status;
             $crmSupplierOrderHelper->redSHOPOrderUpdate($row->order_id, $getStatus);
             unset($getStatus);
         }
     }
     $checkOrderStatus = 1;
     if ($postdata['payment_method_class'] == "rs_payment_banktransfer" || $postdata['payment_method_class'] == "rs_payment_banktransfer_discount" || $postdata['payment_method_class'] == "rs_payment_banktransfer2" || $postdata['payment_method_class'] == "rs_payment_banktransfer3" || $postdata['payment_method_class'] == "rs_payment_banktransfer4" || $postdata['payment_method_class'] == "rs_payment_banktransfer5") {
         $checkOrderStatus = 0;
     }
     // Economic Integration start for invoice generate and book current invoice
     if (ECONOMIC_INTEGRATION == 1 && ECONOMIC_INVOICE_DRAFT != 2) {
         $issplit = 0;
         $economic = new economic();
         if (isset($postdata['issplit']) && $postdata['issplit'] == 1) {
             $issplit = 1;
         }
         $economicdata['split_payment'] = $issplit;
         $economicdata['economic_payment_terms_id'] = $postdata['economic_payment_terms_id'];
         $economicdata['economic_design_layout'] = $postdata['economic_design_layout'];
         $economicdata['economic_is_creditcard'] = $postdata['economic_is_creditcard'];
         $payment_name = $postdata['payment_method_class'];
         $paymentArr = explode("rs_payment_", $postdata['payment_method_class']);
         if (count($paymentArr) > 0) {
             $payment_name = $paymentArr[1];
         }
         $economicdata['economic_payment_method'] = $payment_name;
         $invoiceHandle = $economic->createInvoiceInEconomic($row->order_id, $economicdata);
         if (ECONOMIC_INVOICE_DRAFT == 0) {
             $bookinvoicepdf = $economic->bookInvoiceInEconomic($row->order_id, $checkOrderStatus);
             if (is_file($bookinvoicepdf)) {
                 $ret = $redshopMail->sendEconomicBookInvoiceMail($row->order_id, $bookinvoicepdf);
             }
         }
     }
     // ORDER MAIL SEND
     if ($postdata['task'] != "save_without_sendmail") {
         $redshopMail->sendOrderMail($row->order_id);
     }
     return $row;
 }
 public function replaceSubPropertyData($product_id = 0, $accessory_id = 0, $attribute_id = 0, $property_id = 0, $user_id, $uniqueid = "")
 {
     $producthelper = new producthelper();
     $subproperty = array();
     if ($property_id != 0 && $attribute_id != 0) {
         $attributes = $producthelper->getProductAttribute(0, 0, $attribute_id);
         $attributes = $attributes[0];
         $subproperty = $producthelper->getAttibuteSubProperty(0, $property_id);
     }
     if ($accessory_id != 0) {
         $prefix = $uniqueid . "acc_";
     } else {
         $prefix = $uniqueid . "prd_";
     }
     $attributelist = "";
     if (count($subproperty) > 0) {
         $commonid = $prefix . $product_id . '_' . $accessory_id . '_' . $attribute_id . '_' . $property_id;
         $subpropertyid = 'subproperty_id_' . $commonid;
         for ($i = 0; $i < count($subproperty); $i++) {
             $attributes_subproperty_vat = 0;
             if ($subproperty[$i]->subattribute_color_price > 0) {
                 $attributes_subproperty_vat = $producthelper->getProducttax($product_id, $subproperty[$i]->subattribute_color_price);
                 $subproperty[$i]->subattribute_color_price += $attributes_subproperty_vat;
                 $subproperty[$i]->text = urldecode($subproperty[$i]->subattribute_color_name) . " (" . $subproperty[$i]->oprand . $producthelper->getProductFormattedPrice($subproperty[$i]->subattribute_color_price) . ")";
             } else {
                 $subproperty[$i]->text = urldecode($subproperty[$i]->subattribute_color_name);
             }
             $attributelist .= '<input type="hidden" id="' . $subpropertyid . '_oprand' . $subproperty[$i]->value . '" value="' . $subproperty[$i]->oprand . '" />';
             $attributelist .= '<input type="hidden" id="' . $subpropertyid . '_protax' . $subproperty[$i]->value . '" value="' . $attributes_subproperty_vat . '" />';
             $attributelist .= '<input type="hidden" id="' . $subpropertyid . '_proprice' . $subproperty[$i]->value . '" value="' . $subproperty[$i]->subattribute_color_price . '" />';
         }
         $tmp_array = array();
         $tmp_array[0]->value = 0;
         $tmp_array[0]->text = JText::_('COM_REDSHOP_SELECT') . "&nbsp;" . urldecode($subproperty[0]->property_name);
         $new_subproperty = array_merge($tmp_array, $subproperty);
         $chklist = "";
         if ($attributes->allow_multiple_selection) {
             for ($chk = 0; $chk < count($subproperty); $chk++) {
                 $chklist .= "<br /><input type='checkbox' value='" . $subproperty[$chk]->value . "' name='" . $subpropertyid . "[]'  id='" . $subpropertyid . "' class='inputbox' onchange='javascript:calculateOfflineTotalPrice(\"" . $uniqueid . "\");' />&nbsp;" . $subproperty[$chk]->text;
             }
         } else {
             $chklist = JHTML::_('select.genericlist', $new_subproperty, $subpropertyid . '[]', ' id="' . $subpropertyid . '" class="inputbox" size="1" onchange="javascript:calculateOfflineTotalPrice(\'' . $uniqueid . '\');" ', 'value', 'text', '');
         }
         $lists['subproperty_id'] = $chklist;
         $attributelist .= "<tr><td>" . urldecode($subproperty[0]->property_name) . " : " . $lists['subproperty_id'];
     }
     return $attributelist;
 }
Esempio n. 8
0
					</td>
					<td>
						<?php 
    if ($row->coupon_type == 0) {
        echo JText::_('COM_REDSHOP_GLOBAL');
    } else {
        echo JText::_('COM_REDSHOP_USER_SPECIFIC');
    }
    ?>
					</td>
					<td align="center">
						<?php 
    if ($row->percent_or_total != 0) {
        echo $row->coupon_value . " %";
    } else {
        echo $producthelper->getProductFormattedPrice($row->coupon_value);
        //number_format($row->coupon_value,2,PRICE_SEPERATOR,THOUSAND_SEPERATOR);
    }
    ?>
					</td>
					<td align="center">
						<?php 
    echo $row->coupon_left;
    ?>
					</td>
					<td align="center">
						<?php 
    echo $published;
    ?>
					</td>
					<td align="center">
Esempio n. 9
0
		</form>';
$cart_data = str_replace("{empty_cart}", $empty_cart, $cart_data);
$discount = $producthelper->getDiscountId(0);
if (count($discount) > 0) {
    $text = '';
    if ($discount->discount_type == 0) {
        $discount_amount = $discount->discount_amount;
        $discount_sign = " " . REDCURRENCY_SYMBOL;
    } else {
        $discount_amount = $discount->amount * $discount->discount_amount / 100;
        $discount_sign = " %";
    }
    $diff = $discount->amount - $cart['product_subtotal'];
    $price = number_format($discount->discount_amount, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR);
    if ($diff > 0) {
        $text = sprintf(JText::_('COM_REDSHOP_DISCOUNT_TEXT'), $producthelper->getProductFormattedPrice($diff, true), $producthelper->getProductFormattedPrice($discount_amount, true), $price . $discount_sign);
    }
    /*
     *  Discount type =  1 // Discount/coupon/voucher
     *  Discount type =  2 // Discount + coupon/voucher
     *  Discount type =  3 // Discount + coupon + voucher
     *  Discount type =  4 // Discount + coupons + voucher
     */
    if (DISCOUNT_TYPE && DISCOUNT_ENABLE == 1) {
        $cart_data = str_replace("{discount_rule}", $text, $cart_data);
    } else {
        $cart_data = str_replace("{discount_rule}", '', $cart_data);
    }
} else {
    $cart_data = str_replace("{discount_rule}", '', $cart_data);
}
Esempio n. 10
0
    $itemId = (int) $redhelper->getCategoryItemid();
}
$display_button = JText::_('COM_REDSHOP_CHECKOUT');
if ($button_text != "") {
    $display_button = $button_text;
}
$link = JRoute::_("index.php?option=com_redshop&view=cart&Itemid=" . $itemId);
$cartTotalProduct = $count;
$cartTotallbl = "";
$cartTotalValue = "";
$shippingvalue = "";
$shippinglbl = "";
if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) {
    $cartTotallbl = JText::_('COM_REDSHOP_TOTAL') . ':';
    $shippinglbl = JText::_('COM_REDSHOP_SHIPPING_LBL') . ':';
    $cartTotalValue = $producthelper->getProductFormattedPrice($total);
    $shippingvalue = $producthelper->getProductFormattedPrice($shipping);
}
?>
<div class="mod_cart_main">
	<div class="mod_cart_top">
		<div class="mod_cart_image"></div>
		<div class="mod_cart_title"><?php 
echo JText::_('COM_REDSHOP_CART_TEXT');
?>
</div>
	</div>
	<div class="mod_cart_total" id="mod_cart_total">
		<?php 
switch ($output_view) {
    case 'simple':
Esempio n. 11
0
    $itemId = (int) $redhelper->getCategoryItemid();
}
$display_button = JText::_('COM_REDSHOP_CHECKOUT');
if ($button_text != "") {
    $display_button = $button_text;
}
$link = JRoute::_("index.php?option=com_redshop&view=cart&Itemid=" . $itemId);
$cartTotalProduct = $count;
$cartTotallbl = "";
$cartTotalValue = "";
$shippingvalue = "";
$shippinglbl = "";
if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) {
    $cartTotallbl = JText::_('COM_REDSHOP_TOTAL') . ':';
    $shippinglbl = JText::_('COM_REDSHOP_SHIPPING_LBL') . ':';
    $cartTotalValue = $producthelper->getProductFormattedPrice($total);
    $shippingvalue = $producthelper->getProductFormattedPrice($shipping);
}
?>
<div class="mod_cart_main">
	<div class="mod_cart_top">

		<div class="mod_cart_title">
			<?php 
echo $cartTotalValue;
?>
 (<span class="mod_cart_title_total"><?php 
echo $cartTotalProduct;
?>
</span>)
		</div>
Esempio n. 12
0
					<td align="center"><?php 
    echo $i + 1;
    ?>
</td>
					<?php 
    if ($this->filteroption) {
        ?>
						<td align="center"><?php 
        echo $row->viewdate;
        ?>
</td>
					<?php 
    }
    ?>
					<td align="center"><?php 
    echo $producthelper->getProductFormattedPrice($row->avg_order);
    //CURRENCY_SYMBOL.number_format($row->avg_order,2,PRICE_SEPERATOR,THOUSAND_SEPERATOR);
    ?>
</td>
				</tr>
			<?php 
}
?>
			<tfoot>
			<td colspan="3"><?php 
echo $this->pagination->getListFooter();
?>
</td>
			</tfoot>
		</table>
	</div>
Esempio n. 13
0
 /**
  * One Step checkout process
  *
  * @return void
  */
 public function oneStepCheckoutProcess()
 {
     $producthelper = new producthelper();
     $redTemplate = new Redtemplate();
     $carthelper = new rsCarthelper();
     $order_functions = new order_functions();
     $model = $this->getModel('checkout');
     $post = JRequest::get('post');
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     $users_info_id = $post['users_info_id'];
     $shipping_box_id = $post['shipping_box_id'];
     $shipping_rate_id = $post['shipping_rate_id'];
     $customer_note = $post['customer_note'];
     $req_number = $post['requisition_number'];
     $customer_message = $post['rs_customer_message_ta'];
     $referral_code = $post['txt_referral_code'];
     $payment_method_id = $post['payment_method_id'];
     $order_total = $cart['total'];
     $total_discount = $cart['cart_discount'] + $cart['voucher_discount'] + $cart['coupon_discount'];
     $order_subtotal = SHIPPING_AFTER == 'total' ? $cart['product_subtotal'] - $total_discount : $cart['product_subtotal_excl_vat'];
     $Itemid = $post['Itemid'];
     $objectname = $post['objectname'];
     $rate_template_id = $post['rate_template_id'];
     $cart_template_id = $post['cart_template_id'];
     $onestep_template_desc = "";
     $rate_template_desc = "";
     if ($objectname == "users_info_id" || $objectname == "shipping_box_id") {
         if ($users_info_id > 0) {
             $shipping_template = $redTemplate->getTemplate("redshop_shipping", $rate_template_id);
             if (count($shipping_template) > 0) {
                 $rate_template_desc = $shipping_template[0]->template_desc;
             }
             $returnarr = $carthelper->replaceShippingTemplate($rate_template_desc, $shipping_rate_id, $shipping_box_id, $user->id, $users_info_id, $order_total, $order_subtotal);
             $rate_template_desc = $returnarr['template_desc'];
             $shipping_rate_id = $returnarr['shipping_rate_id'];
         } else {
             $rate_template_desc = JText::_('COM_REDSHOP_FILL_SHIPPING_ADDRESS');
         }
     }
     if ($shipping_rate_id != "") {
         $shipArr = $model->calculateShipping($shipping_rate_id);
         $cart['shipping'] = $shipArr['order_shipping_rate'];
         $cart['shipping_vat'] = $shipArr['shipping_vat'];
         $cart = $carthelper->modifyDiscount($cart);
     }
     if ($cart_template_id != 0) {
         $templatelist = $redTemplate->getTemplate("checkout", $cart_template_id);
         $onestep_template_desc = $templatelist[0]->template_desc;
         $onestep_template_desc = $model->displayShoppingCart($onestep_template_desc, $users_info_id, $shipping_rate_id, $payment_method_id, $Itemid, $customer_note, $req_number, '', $customer_message, $referral_code);
     }
     $display_shippingrate = '<div id="onestepshiprate">' . $rate_template_desc . '</div>';
     $display_cart = '<div id="onestepdisplaycart">' . $onestep_template_desc . '</div>';
     $description = $display_shippingrate . $display_cart;
     $lang = JFactory::getLanguage();
     $Locale = $lang->getLocale();
     if (in_array('ru', $Locale)) {
         // Commented because redshop currency symbole has been changed because of ajax response
         $description = html_entity_decode($description, ENT_QUOTES, 'KOI8-R');
     }
     $cart_total = $producthelper->getProductFormattedPrice($cart['mod_cart_total']);
     echo "`_`" . $description . "`_`" . $cart_total;
     die;
 }
Esempio n. 14
0
    }
}
if ($gid != 0) {
    $count_no_user_field = 0;
    $detail = $detail[0];
    $template = str_replace("{giftcard_name}", $detail->giftcard_name, $template);
    $template = str_replace("{giftcard_desc}", $detail->giftcard_desc, $template);
    if (strstr($template, "{giftcard_image}")) {
        $product_img = $objhelper->watermark('giftcard', $detail->giftcard_image, GIFTCARD_THUMB_WIDTH, GIFTCARD_THUMB_HEIGHT, WATERMARK_GIFTCART_THUMB_IMAGE, '0');
        $linkimage = $objhelper->watermark('giftcard', $detail->giftcard_image, '', '', WATERMARK_GIFTCART_IMAGE, '0');
        $thum_image = "<a class=\"modal\" href='" . $linkimage . "' title='" . $detail->giftcard_name . "' rel=\"{handler: 'image', size: {}}\">";
        $thum_image .= "<img src='" . $product_img . "' title='" . $detail->giftcard_name . "' alt='" . $detail->giftcard_name . "'>";
        $thum_image .= "</a>";
        $template = str_replace("{giftcard_image}", $thum_image, $template);
    }
    $template = str_replace("{giftcard_value}", $producthelper->getProductFormattedPrice($detail->giftcard_value), $template);
    $template = str_replace("{giftcard_value_lbl}", JText::_('COM_REDSHOP_GIFTCARD_VALUE_LBL'), $template);
    if ($detail->customer_amount != 1) {
        $template = str_replace("{giftcard_price_lbl}", JText::_('COM_REDSHOP_GIFTCARD_PRICE_LBL'), $template);
    } else {
        $template = str_replace("{giftcard_price_lbl}", '', $template);
    }
    if ($detail->customer_amount != 1) {
        $template = str_replace("{giftcard_price}", $producthelper->getProductFormattedPrice($detail->giftcard_price), $template);
    } else {
        $template = str_replace("{giftcard_price}", '', $template);
    }
    $reciver_email = '<input type="text" name="reciver_email" id="reciver_email" value="' . @$cart['reciver_email'] . '" onkeyup="var f_value = this.value;addtocart_prd_' . $gid . '.reciver_email.value = f_value;">';
    $reciver_name = '<input type="text" name="reciver_name" id="reciver_name" value="' . @$cart['reciver_name'] . '" onkeyup="var f_value = this.value;addtocart_prd_' . $gid . '.reciver_name.value = f_value;">';
    $customer_amount = '';
    $customer_quantity = '';
Esempio n. 15
0
 public function neworderitem($data, $quantity, $order_item_id)
 {
     $adminproducthelper = new adminproducthelper();
     $producthelper = new producthelper();
     $rsCarthelper = new rsCarthelper();
     $stockroomhelper = new rsstockroomhelper();
     // Get Order Info
     $orderdata = $this->getTable('order_detail');
     $orderdata->load($this->_id);
     $item = $data['order_item'];
     // Get product Info
     // Set Order Item Info
     $orderitemdata = $this->getTable('order_item_detail');
     $orderitemdata->load($order_item_id);
     $user_id = $orderdata->user_id;
     for ($i = 0; $i < count($item); $i++) {
         $product_id = $item[$i]->product_id;
         $product_excl_price = $item[$i]->prdexclprice;
         $product_price = $item[$i]->productprice;
         // Attribute price added
         $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
         $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
         $product_attribute = $retAttArr[0];
         // Accessory price
         $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
         $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
         $product_accessory = $retAccArr[0];
         $wrapper_price = 0;
         $wrapper_vat = 0;
         if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') {
             $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
             if (count($wrapper) > 0) {
                 if ($wrapper[0]->wrapper_price > 0) {
                     $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
                 }
                 $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
             }
         }
         $product = $producthelper->getProductById($product_id);
         $updatestock = $stockroomhelper->updateStockroomQuantity($product_id, $quantity);
         $stockroom_id_list = $updatestock['stockroom_list'];
         $stockroom_quantity_list = $updatestock['stockroom_quantity_list'];
         $orderitemdata->stockroom_id = $stockroom_id_list;
         $orderitemdata->stockroom_quantity = $stockroom_quantity_list;
         $orderitemdata->order_item_id = 0;
         $orderitemdata->order_id = $this->_id;
         $orderitemdata->user_info_id = $orderdata->user_info_id;
         $orderitemdata->supplier_id = $product->manufacturer_id;
         $orderitemdata->product_id = $product_id;
         $orderitemdata->order_item_sku = $product->product_number;
         $orderitemdata->order_item_name = $product->product_name;
         $orderitemdata->product_quantity = $quantity;
         $orderitemdata->product_item_price = $product_price;
         $orderitemdata->product_item_price_excl_vat = $product_excl_price;
         $orderitemdata->product_final_price = $product_price * $quantity;
         $orderitemdata->order_item_currency = REDCURRENCY_SYMBOL;
         $orderitemdata->order_status = "P";
         $orderitemdata->cdate = time();
         $orderitemdata->mdate = time();
         $orderitemdata->product_attribute = $product_attribute;
         $orderitemdata->product_accessory = $product_accessory;
         $orderitemdata->wrapper_id = $item[$i]->wrapper_data;
         $orderitemdata->wrapper_price = $wrapper_price;
         if ($producthelper->checkProductDownload($product_id)) {
             $medianame = $producthelper->getProductMediaName($product_id);
             for ($j = 0; $j < count($medianame); $j++) {
                 $sql = "INSERT INTO " . $this->_table_prefix . "product_download " . "(product_id, user_id, order_id, end_date, download_max, download_id, file_name) " . "VALUES('" . $product_id . "', '" . $user_id . "', '" . $this->_id . "', " . "'" . (time() + PRODUCT_DOWNLOAD_DAYS * 23 * 59 * 59) . "', '" . PRODUCT_DOWNLOAD_LIMIT . "', " . "'" . md5(uniqid(mt_rand(), true)) . "', '" . $medianame[$j]->media_name . "')";
                 $this->_db->setQuery($sql);
                 $this->_db->query();
             }
         }
         if (!$orderitemdata->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         /** my accessory save in table start */
         if (count($generateAccessoryCart) > 0) {
             $attArr = $generateAccessoryCart;
             for ($a = 0; $a < count($attArr); $a++) {
                 $accessory_vat_price = 0;
                 $accessory_attribute = "";
                 $accessory_id = $attArr[$a]['accessory_id'];
                 $accessory_name = $attArr[$a]['accessory_name'];
                 $accessory_price = $attArr[$a]['accessory_price'];
                 $accessory_org_price = $accessory_price;
                 if ($accessory_price > 0) {
                     $accessory_vat_price = $producthelper->getProductTax($product_id, $accessory_price, $user_id);
                 }
                 $attchildArr = $attArr[$a]['accessory_childs'];
                 for ($j = 0; $j < count($attchildArr); $j++) {
                     $attribute_id = $attchildArr[$j]['attribute_id'];
                     $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>";
                     $rowattitem =& $this->getTable('order_attribute_item');
                     $rowattitem->order_att_item_id = 0;
                     $rowattitem->order_item_id = $orderitemdata->order_item_id;
                     $rowattitem->section_id = $attribute_id;
                     $rowattitem->section = "attribute";
                     $rowattitem->parent_section_id = $accessory_id;
                     $rowattitem->section_name = $attchildArr[$j]['attribute_name'];
                     $rowattitem->is_accessory_att = 1;
                     if ($attribute_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $propArr = $attchildArr[$j]['attribute_childs'];
                     for ($k = 0; $k < count($propArr); $k++) {
                         $section_vat = 0;
                         if ($propArr[$k]['property_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $user_id);
                         }
                         $property_id = $propArr[$k]['property_id'];
                         $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>";
                         $subpropArr = $propArr[$k]['property_childs'];
                         $rowattitem =& $this->getTable('order_attribute_item');
                         $rowattitem->order_att_item_id = 0;
                         $rowattitem->order_item_id = $orderitemdata->order_item_id;
                         $rowattitem->section_id = $property_id;
                         $rowattitem->section = "property";
                         $rowattitem->parent_section_id = $attribute_id;
                         $rowattitem->section_name = $propArr[$k]['property_name'];
                         $rowattitem->section_price = $propArr[$k]['property_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                         $rowattitem->is_accessory_att = 1;
                         if ($property_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                         for ($l = 0; $l < count($subpropArr); $l++) {
                             $section_vat = 0;
                             if ($subpropArr[$l]['subproperty_price'] > 0) {
                                 $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                             }
                             $subproperty_id = $subpropArr[$l]['subproperty_id'];
                             $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>";
                             $rowattitem =& $this->getTable('order_attribute_item');
                             $rowattitem->order_att_item_id = 0;
                             $rowattitem->order_item_id = $orderitemdata->order_item_id;
                             $rowattitem->section_id = $subproperty_id;
                             $rowattitem->section = "subproperty";
                             $rowattitem->parent_section_id = $property_id;
                             $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                             $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                             $rowattitem->section_vat = $section_vat;
                             $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                             $rowattitem->is_accessory_att = 1;
                             if ($subproperty_id > 0) {
                                 if (!$rowattitem->store()) {
                                     $this->setError($this->_db->getErrorMsg());
                                     return false;
                                 }
                             }
                         }
                     }
                 }
                 $accdata =& $this->getTable('accessory_detail');
                 if ($accessory_id > 0) {
                     $accdata->load($accessory_id);
                 }
                 $accessoryproduct = $producthelper->getProductById($accdata->child_product_id);
                 $rowaccitem =& $this->getTable('order_acc_item');
                 $rowaccitem->order_item_acc_id = 0;
                 $rowaccitem->order_item_id = $orderitemdata->order_item_id;
                 $rowaccitem->product_id = $accessory_id;
                 $rowaccitem->order_acc_item_sku = $accessoryproduct->product_number;
                 $rowaccitem->order_acc_item_name = $accessory_name;
                 $rowaccitem->order_acc_price = $accessory_org_price;
                 $rowaccitem->order_acc_vat = $accessory_vat_price;
                 $rowaccitem->product_quantity = $quantity;
                 $rowaccitem->product_acc_item_price = $accessory_price;
                 $rowaccitem->product_acc_final_price = $accessory_price * $quantity;
                 $rowaccitem->product_attribute = $accessory_attribute;
                 if ($accessory_id > 0) {
                     if (!$rowaccitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
             }
         }
         /** my attribute save in table start */
         if (count($generateAttributeCart) > 0) {
             $attArr = $generateAttributeCart;
             for ($j = 0; $j < count($attArr); $j++) {
                 $attribute_id = $attArr[$j]['attribute_id'];
                 $rowattitem =& $this->getTable('order_attribute_item');
                 $rowattitem->order_att_item_id = 0;
                 $rowattitem->order_item_id = $orderitemdata->order_item_id;
                 $rowattitem->section_id = $attribute_id;
                 $rowattitem->section = "attribute";
                 $rowattitem->parent_section_id = $product_id;
                 $rowattitem->section_name = $attArr[$j]['attribute_name'];
                 $rowattitem->is_accessory_att = 0;
                 if ($attribute_id > 0) {
                     if (!$rowattitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
                 $propArr = $attArr[$j]['attribute_childs'];
                 for ($k = 0; $k < count($propArr); $k++) {
                     $section_vat = 0;
                     if ($propArr[$k]['property_price'] > 0) {
                         $section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $usre_id);
                     }
                     $property_id = $propArr[$k]['property_id'];
                     /** product property STOCKROOM update start */
                     $updatestock = $stockroomhelper->updateStockroomQuantity($property_id, $quantity, "property");
                     $rowattitem =& $this->getTable('order_attribute_item');
                     $rowattitem->order_att_item_id = 0;
                     $rowattitem->order_item_id = $orderitemdata->order_item_id;
                     $rowattitem->section_id = $property_id;
                     $rowattitem->section = "property";
                     $rowattitem->parent_section_id = $attribute_id;
                     $rowattitem->section_name = $propArr[$k]['property_name'];
                     $rowattitem->section_price = $propArr[$k]['property_price'];
                     $rowattitem->section_vat = $section_vat;
                     $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                     $rowattitem->is_accessory_att = 0;
                     if ($property_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $subpropArr = $propArr[$k]['property_childs'];
                     for ($l = 0; $l < count($subpropArr); $l++) {
                         $section_vat = 0;
                         if ($subpropArr[$l]['subproperty_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                         }
                         $subproperty_id = $subpropArr[$l]['subproperty_id'];
                         /** product subproperty STOCKROOM update start */
                         $updatestock = $stockroomhelper->updateStockroomQuantity($subproperty_id, $quantity, "subproperty");
                         $rowattitem =& $this->getTable('order_attribute_item');
                         $rowattitem->order_att_item_id = 0;
                         $rowattitem->order_item_id = $orderitemdata->order_item_id;
                         $rowattitem->section_id = $subproperty_id;
                         $rowattitem->section = "subproperty";
                         $rowattitem->parent_section_id = $property_id;
                         $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                         $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                         $rowattitem->is_accessory_att = 0;
                         if ($subproperty_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                     }
                 }
             }
         }
         if (USE_CONTAINER) {
             $producthelper->updateContainerStock($product_id, $quantity, $orderitemdata->container_id);
         }
         // Store userfields
         $userfields = $item[$i]->extrafieldname;
         $userfields_id = $item[$i]->extrafieldId;
         for ($ui = 0; $ui < count($userfields); $ui++) {
             $adminproducthelper->admin_insertProdcutUserfield($userfields_id[$ui], $orderitemdata->order_item_id, 12, $userfields[$ui]);
         }
     }
     if ($orderitemdata->order_item_id > 0) {
         $totalItemVat = $orderitemdata->product_item_price - $orderitemdata->product_item_price_excl_vat;
         $orderdata->order_tax = $orderdata->order_tax + $totalItemVat * $orderitemdata->product_quantity;
         $orderdata->order_total = $orderdata->order_total + $orderitemdata->product_final_price;
         $orderdata->order_subtotal = $orderdata->order_subtotal + $orderitemdata->product_final_price;
         $orderdata->mdate = time();
         // Update order detail
         if (!$orderdata->store()) {
             return false;
         }
         if (ECONOMIC_INTEGRATION == 1) {
             $economic = new economic();
             $invoiceHandle = $economic->renewInvoiceInEconomic($orderdata);
         }
         // Send mail from template
         $redshopMail = new redshopMail();
         $redshopMail->sendOrderSpecialDiscountMail($this->_id);
     } else {
         return false;
     }
     return true;
 }
Esempio n. 16
0
"
							   title="<?php 
        echo JText::_('COM_REDSHOP_VIEW_IMAGE');
        ?>
"
							   rel="{handler: 'image', size: {}}">
								<?php 
        echo $row->giftcard_bgimage;
        ?>
</a>
						<?php 
    }
    ?>
					</td>
					<td align="center"><?php 
    echo $producthelper->getProductFormattedPrice($row->giftcard_price);
    ?>
</td>
					<td align="center"><?php 
    echo $producthelper->getProductFormattedPrice($row->giftcard_value);
    ?>
</td>
					<td align="center"><?php 
    echo $row->giftcard_validity;
    ?>
</td>
					<td align="center">
						<?php 
    echo $published;
    ?>
					</td>
Esempio n. 17
0
 $template = str_replace('{product_s_desc}', $exp_div . $product->product_s_desc . $div_end . $td_end . $td_start . "{product_s_desc}", $template);
 $template = str_replace('{product_desc}', $exp_div . $product->product_desc . $div_end . $td_end . $td_start . "{product_desc}", $template);
 $product_number_output = '<span id="product_number_variable' . $product->product_id . '">' . $product->product_number . '</span>';
 $template = str_replace('{product_number}', $exp_div . $product->product_number . $div_end . $td_end . $td_start . "{product_number}", $template);
 $product_weight_unit = '<span class="product_unit_variable">' . DEFAULT_WEIGHT_UNIT . '</span>';
 $template = str_replace('{product_weight}', $exp_div . $producthelper->redunitDecimal($product->weight) . "&nbsp;" . $product_weight_unit . $div_end . $td_end . $td_start . "{product_weight}", $template);
 $product_unit = '<span class="product_unit_variable">' . DEFAULT_VOLUME_UNIT . '</span>';
 $template = str_replace('{product_length}', $exp_div . $producthelper->redunitDecimal($product->product_length) . "&nbsp;" . $product_unit . $div_end . $td_end . $td_start . "{product_length}", $template);
 $template = str_replace('{product_height}', $exp_div . $producthelper->redunitDecimal($product->product_height) . "&nbsp;" . $product_unit . $div_end . $td_end . $td_start . "{product_height}", $template);
 $template = str_replace('{product_width}', $exp_div . $producthelper->redunitDecimal($product->product_width) . "&nbsp;" . $product_unit . $div_end . $td_end . $td_start . "{product_width}", $template);
 $product_volume_unit = '<span class="product_unit_variable">' . DEFAULT_VOLUME_UNIT . "3" . '</span>';
 $template = str_replace('{product_volume}', $exp_div . $producthelper->redunitDecimal($product->product_volume) . "&nbsp;" . $product_volume_unit . $div_end . $td_end . $td_start . "{product_volume}", $template);
 if (strstr($template, "{product_price}")) {
     $price = 0;
     if (SHOW_PRICE && !USE_AS_CATALOG && (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE)) {
         $price = $producthelper->getProductFormattedPrice($product->product_price);
     }
     $template = str_replace('{product_price}', $exp_div . $price . $div_end . $td_end . $td_start . "{product_price}", $template);
 }
 if (strstr($template, "{product_rating_summary}")) {
     $final_avgreview_data = $producthelper->getProductRating($compare[$i]["product_id"]);
     $template = str_replace('{product_rating_summary}', $exp_div . $final_avgreview_data . $div_end . $td_end . $td_start . "{product_rating_summary}", $template);
 }
 if (strstr($template, "{products_in_stock}") || strstr($template, "{product_stock_amount_image}")) {
     $product_stock = $stockroomhelper->getStockAmountwithReserve($compare[$i]["product_id"]);
     $template = str_replace('{products_in_stock}', $exp_div . $product_stock . $div_end . $td_end . $td_start . "{products_in_stock}", $template);
     $stockamountList = $stockroomhelper->getStockAmountImage($compare[$i]["product_id"], "product", $product_stock);
     $stockamountImage = "";
     if (count($stockamountList) > 0) {
         $stockamountImage = '<a class="imgtooltip"><span>';
         $stockamountImage .= '<div class="spnheader">' . JText::_('COM_REDSHOP_STOCK_AMOUNT') . '</div>';
Esempio n. 18
0
    $template_desc = str_replace('{bulkorder_link}', $bulkorder_link, $template_desc);
} else {
    $template_desc = str_replace('{bulkorder_image}', "", $template_desc);
    $template_desc = str_replace('{bulkorder_title}', "", $template_desc);
    $template_desc = str_replace('{bulkorder_link}', "", $template_desc);
}
$is_company = $this->userdata->is_company;
if ($is_company == 1) {
    $extrafields = $extra_field->list_all_field_display(8, $this->userdata->users_info_id);
} else {
    $extrafields = $extra_field->list_all_field_display(7, $this->userdata->users_info_id);
}
$template_desc = str_replace('{customer_custom_fields}', $extrafields, $template_desc);
if (strstr($template_desc, "{reserve_discount}")) {
    $reserve_discount = $model->getReserveDiscount();
    $reserve_discount = $producthelper->getProductFormattedPrice($reserve_discount);
    $template_desc = str_replace('{reserve_discount}', $reserve_discount, $template_desc);
    $template_desc = str_replace('{reserve_discount_lbl}', JText::_('COM_REDSHOP_RESERVED_DISCOUNT_LBL'), $template_desc);
}
if (strstr($template_desc, "{order_loop_start}") && strstr($template_desc, "{order_loop_end}")) {
    $oder_image = '<img src="' . REDSHOP_ADMIN_IMAGES_ABSPATH . 'order16.png" align="absmiddle">';
    $template_desc = str_replace('{order_image}', $oder_image, $template_desc);
    $template_desc = str_replace('{order_title}', JText::_('COM_REDSHOP_ORDER_INFORMATION'), $template_desc);
    $orderslist = $order_functions->getUserOrderDetails($user->id);
    // More Order information
    if (count($orderslist) > 0) {
        $ordermoreurl_1 = JRoute::_('index.php?option=com_redshop&view=orders&Itemid=' . $Itemid);
        $ordermoreurl = strtolower($ordermoreurl_1);
        $template_desc = str_replace('{more_orders}', "<a href='" . $ordermoreurl . "'>" . JText::_('COM_REDSHOP_MORE') . "</a>", $template_desc);
    } else {
        $template_desc = str_replace('{more_orders}', "", $template_desc);
Esempio n. 19
0
 $template_end = $template_edata[1];
 $template_middle = $template_edata[0];
 $cart_mdata = "";
 for ($i = 0; $i < count($this->detail); $i++) {
     $prolist = $order_function->getOrderItemDetail($this->detail[$i]->order_id);
     $statusname = $order_function->getOrderStatusTitle($this->detail[$i]->order_status);
     $order_item_name = array();
     for ($j = 0; $j < count($prolist); $j++) {
         $order_item_name[$j] = $prolist[$j]->order_item_name;
     }
     $orderdetailurl = JRoute::_('index.php?option=com_redshop&view=order_detail&oid=' . $this->detail[$i]->order_id);
     $reorderurl = JUri::root() . 'index.php?option=com_redshop&view=order_detail&order_id=' . $this->detail[$i]->order_id . '&task=reorder&tmpl=component';
     $order_number = "<div class='order_number'>" . $this->detail[$i]->order_number . "</div>";
     $order_id = "<div class='order_id'>" . $this->detail[$i]->order_id . "</div>";
     $order_products = "<div class='order_products'>" . implode(',<br/>', $order_item_name) . "</div>";
     $order_total = "<div class='order_total'>" . $producthelper->getProductFormattedPrice($this->detail[$i]->order_total) . "</div>";
     $order_date = "<div class='order_date'>" . $redconfig->convertDateFormat($this->detail[$i]->cdate) . "</div>";
     $order_status = "<div class='order_status'>" . $statusname . "</div>";
     $order_detail_link = "<div class='order_detail_link'><a href='" . $orderdetailurl . "'>" . JText::_('COM_REDSHOP_ORDER_DETAIL') . "</a></div>";
     $reorder_link = "<div class='reorder_link'><a href='javascript:if(confirm(\"" . JText::_('COM_REDSHOP_CONFIRM_CART_EMPTY') . "\")){window.location=\"" . $reorderurl . "\";}'>" . JText::_('COM_REDSHOP_REORDER') . "</a></div>";
     $cart_mdata .= $template_middle;
     $cart_mdata = str_replace("{order_number}", $order_number, $cart_mdata);
     $cart_mdata = str_replace("{order_id}", $order_id, $cart_mdata);
     $cart_mdata = str_replace("{order_products}", $order_products, $cart_mdata);
     $cart_mdata = str_replace("{order_total}", $order_total, $cart_mdata);
     $cart_mdata = str_replace("{order_date}", $order_date, $cart_mdata);
     $cart_mdata = str_replace("{order_status}", $order_status, $cart_mdata);
     $cart_mdata = str_replace("{order_detail_link}", $order_detail_link, $cart_mdata);
     $cart_mdata = str_replace("{reorder_link}", $reorder_link, $cart_mdata);
 }
 $template_desc = str_replace("{product_loop_start}", "", $template_desc);
Esempio n. 20
0
					</td>
					<td align="center">
						<?php 
    echo JHTML::_('grid.id', $i, $row->id);
    ?>
					</td>
					<td align="center">
						<a href="<?php 
    echo $link;
    ?>
" title="<?php 
    echo JText::_('COM_REDSHOP_EDIT_DISCOUNT');
    ?>
">
							<?php 
    echo $producthelper->getProductFormattedPrice($row->amount);
    //number_format($row->amount,2,PRICE_SEPERATOR,THOUSAND_SEPERATOR).CURRENCY_SYMBOL;
    ?>
</a>
					</td>
					<td align="center">
						<?php 
    switch ($row->condition) {
        case '1':
            echo JText::_('COM_REDSHOP_LOWER');
            break;
        case '2':
            echo JText::_('COM_REDSHOP_EQUAL');
            break;
        case '3':
            echo JText::_('COM_REDSHOP_HIGHER');
Esempio n. 21
0
?>
  value="true"
						       name="order_sendordermail"
						       id="order_sendordermail"/><?php 
echo JText::_('COM_REDSHOP_SEND_ORDER_MAIL');
?>
						<input class="button" onclick="this.form.submit();" name="order_status"
						       value="<?php 
echo JText::_('COM_REDSHOP_UPDATE_STATUS_BUTTON');
?>
" type="button">
						<br/><br/>
						<?php 
$partial_paid = $order_functions->getOrderPartialPayment($order_id);
$remaningtopay = $this->detail->order_total - $partial_paid;
$remaningtopay = $producthelper->getProductFormattedPrice($remaningtopay);
//number_format($remaningtopay,2);
?>
						<?php 
if ($this->detail->split_payment) {
    echo "<strong>" . JText::_('COM_REDSHOP_ORDER_DETAIL_PARTIALLY_PAID_AMOUNT') . ": " . $producthelper->getProductFormattedPrice($partial_paid) . "</strong>";
}
?>
					</td>
				</tr>
				<tr>
					<td><?php 
echo JText::_('COM_REDSHOP_COMMENT');
?>
:</td>
					<td>
Esempio n. 22
0
"
							   title="<?php 
        echo JText::_('COM_REDSHOP_VIEW_IMAGE');
        ?>
"
							   rel="{handler: 'image', size: {}}">
								<?php 
        echo $row->wrapper_image;
        ?>
</a>
						<?php 
    }
    ?>
					</td>
					<td align="center"><?php 
    echo $producthelper->getProductFormattedPrice($row->wrapper_price);
    //CURRENCY_SYMBOL.number_format($row->wrapper_price,2,PRICE_SEPERATOR,THOUSAND_SEPERATOR);
    ?>
</td>
					<td align="center"><?php 
    echo $enable_default;
    ?>
</td>
					<td align="center"><?php 
    echo $published;
    ?>
</td>
					<td align="center"><?php 
    echo $row->id;
    ?>
</td>
Esempio n. 23
0
</td>
					</tr>
				<?php 
    }
    ?>
				<tr>
					<td align="center"><?php 
    echo $i + 1;
    ?>
</td>
					<td align="center"><?php 
    echo $row->firstname . ' ' . $row->lastname;
    ?>
</td>
					<td align="center"><?php 
    echo $producthelper->getProductFormattedPrice($row->order_total);
    //CURRENCY_SYMBOL.number_format($row->order_total,2,PRICE_SEPERATOR,THOUSAND_SEPERATOR);
    ?>
</td>
				</tr>
			<?php 
}
?>
			<tfoot>
			<td colspan="3"><?php 
echo $this->pagination->getListFooter();
?>
</td>
			</tfoot>
		</table>
	</div>
Esempio n. 24
0
    ?>
</td>
					<td><?php 
    echo $row->username;
    ?>
</td>
					<td><?php 
    $shoppergroup = $userhelper->getShopperGroupList($row->shopper_group_id);
    if (count($shoppergroup) > 0) {
        echo $shoppergroup[0]->text;
    }
    ?>
</td>
					<td align="center"><?php 
    $totalsales = $model->customertotalsales($row->user_id);
    echo $producthelper->getProductFormattedPrice($totalsales);
    ?>
</td>
					<td align="center" width="5%"><?php 
    echo $row->users_info_id;
    ?>
</td>
				</tr>
				<?php 
    $k = 1 - $k;
}
?>
			<tfoot>
			<td colspan="11"><?php 
echo $this->pagination->getListFooter();
?>
Esempio n. 25
0
$search[] = "{discount_type_lbl}";
$replace[] = JText::_('COM_REDSHOP_CART_DISCOUNT_CODE_TBL');
if ($discount_type) {
    $search[] = "{discount_type}";
    $replace[] = $discount_type;
} else {
    $search[] = "{discount_type}";
    $replace[] = JText::_('COM_REDSHOP_NO_DISCOUNT_AVAILABLE');
}
$statustext = $order_functions->getOrderStatusTitle($OrdersDetail->order_status);
$issplit = $OrdersDetail->split_payment;
$split_amount = $OrdersDetail->order_total - $partialpayment;
$split_amounttext = "";
$payremaininglink = "";
if ($issplit && $split_amount > 0) {
    $split_amounttext = "<br /><br />" . JText::_('COM_REDSHOP_RECEIPT_PARTIALLY_PAID_AMOUNT') . ": " . $producthelper->getProductFormattedPrice($split_amount);
    $payremaininglink = "<br />" . JText::_('COM_REDSHOP_REMAINING_AMOUNT_TOBE_PAID_BEFORE_DEL') . ": " . $producthelper->getProductFormattedPrice($split_amount) . "<a href='" . JRoute::_('index.php?option=com_redshop&view=split_payment&oid=' . $oid . '&Itemid=' . $Itemid) . "'>" . JText::_('COM_REDSHOP_PAY_REMAINING') . "</a>";
}
$frm = '';
$reorder = '';
if ($OrdersDetail->order_status != 'C' && $OrdersDetail->order_status != 'S' && $OrdersDetail->order_status != 'PR' && $OrdersDetail->order_status != 'APP' && $print != 1 && $OrdersDetail->order_payment_status != 'Paid') {
    $frm = "<form method='post'>\n\t<input type='hidden' name='order_id' value='{$oid}'>\n\t<input type='hidden' name='option' value='com_redshop'>\n\t<input type='hidden' name='view' value='order_detail'>\n\t<input type='hidden' name='task' value='payment'>\n\t<input type='submit' name='payment' value='" . JText::_("COM_REDSHOP_PAY") . "'>\n\t</form>";
} else {
    $reorder = "<form method='post' name='frmreorder' id='frmreorder'>";
    $reorder .= "<input type='submit' name='reorder' id='reorder' value='" . JText::_('COM_REDSHOP_REORDER') . "' onclick='return submitReorder();' />";
    $reorder .= "<input type='hidden' name='order_id' value='" . $oid . "'>";
    $reorder .= "<input type='hidden' name='option' value='com_redshop'>";
    $reorder .= "<input type='hidden' name='view' value='order_detail'>";
    $reorder .= "<input type='hidden' name='task' value='reorder'></form>";
}
$search[] = "{order_status}";
Esempio n. 26
0
</a>
					</td>
					<td align="center"><a href="<?php 
    echo $link;
    ?>
"
					                      style="color:black;"><?php 
    echo $order->tot_order;
    ?>
</a></td>
					<td align="center"><a href="<?php 
    echo $link;
    ?>
"
					                      style="color:black;"><?php 
    echo $producthelper->getProductFormattedPrice($avg_amount);
    ?>
</a>
					</td>
					<td align="center"><a href="<?php 
    echo $link;
    ?>
"
					                      style="color:black;"><?php 
    echo $producthelper->getProductFormattedPrice($order->order_total);
    ?>
</a>
					</td>
				</tr>
				<?php 
    $k = 1 - $k;
Esempio n. 27
0
 public function replaceShippingMethod($d = array(), $shipp_users_info_id = 0, $shipping_rate_id = 0, $shipping_box_post_id = 0)
 {
     $producthelper = new producthelper();
     $order_functions = new order_functions();
     if ($shipp_users_info_id > 0) {
         $shippingmethod = $order_functions->getShippingMethodInfo();
         JPluginHelper::importPlugin('redshop_shipping');
         $dispatcher = JDispatcher::getInstance();
         $shippingrate = $dispatcher->trigger('onListRates', array(&$d));
         $ratearr = array();
         $r = 0;
         for ($s = 0; $s < count($shippingmethod); $s++) {
             if (isset($shippingrate[$s]) === false) {
                 continue;
             }
             $rate = $shippingrate[$s];
             if (count($rate) > 0) {
                 $rs = $shippingmethod[$s];
                 for ($i = 0; $i < count($rate); $i++) {
                     $displayrate = $rate[$i]->rate > 0 ? " (" . $producthelper->getProductFormattedPrice($rate[$i]->rate) . " )" : "";
                     $ratearr[$r] = new stdClass();
                     $ratearr[$r]->text = $rs->name . " - " . $rate[$i]->text . $displayrate;
                     $ratearr[$r]->value = $rate[$i]->value;
                     $r++;
                 }
             }
         }
         if (count($ratearr) > 0) {
             if (!$shipping_rate_id) {
                 $shipping_rate_id = $ratearr[0]->value;
             }
             $displayrespoce = JHTML::_('select.genericlist', $ratearr, 'shipping_rate_id', 'class="inputbox" onchange="calculateOfflineShipping();" ', 'value', 'text', $shipping_rate_id);
         } else {
             $displayrespoce = JText::_('COM_REDSHOP_NO_SHIPPING_METHODS_TO_DISPLAY');
         }
     } else {
         $displayrespoce = '<div class="shipnotice">' . JText::_('COM_REDSHOP_FILL_SHIPPING_ADDRESS') . '</div>';
     }
     return $displayrespoce;
 }
Esempio n. 28
0
    echo $link;
    ?>
"
					       title="<?php 
    echo JText::_('COM_REDSHOP_EDIT_SHIPPING');
    ?>
"><?php 
    echo $row->shipping_rate_name;
    ?>
</a>
					</td>
					<?php 
    if ($bool) {
        ?>
						<td align="center"><?php 
        echo $producthelper->getProductFormattedPrice($row->shipping_rate_value);
        ?>
</td>
					<?php 
    }
    ?>
					<td align="center"><?php 
    echo $row->shipping_rate_id;
    ?>
</td>
				</tr>
				<?php 
    $k = 1 - $k;
}
?>
			<tfoot>
Esempio n. 29
0
 function renderLayout()
 {
     if ($this->config['module_mode'] !== 'normal') {
         $this->render_portal_mode($this->config['module_mode']);
     } else {
         $renderer = new NSP_GK4_Layout_Parts();
         // detecting mode - com_content or K2
         $k2_mode = false;
         $rs_mode = false;
         $vm_mode = false;
         $producthelper = '';
         $redhelper = '';
         //check the source
         if ($this->config["data_source"] == 'k2_categories' || $this->config["data_source"] == 'k2_articles' || $this->config["data_source"] == 'all_k2_articles' || $this->config["data_source"] == 'k2_tags') {
             if ($this->config['k2_categories'] != -1) {
                 $k2_mode = true;
             } else {
                 // exception when K2 is not installed
                 $this->content = array("ID" => array(), "alias" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "author" => array(), "cat_name" => array(), "cat_alias" => array(), "hits" => array(), "news_amount" => 0, "rating_sum" => 0, "rating_count" => 0, "plugins" => '');
             }
         } else {
             if ($this->config["data_source"] == 'redshop_categories' || $this->config["data_source"] == 'redshop_products' || $this->config["data_source"] == 'all_redshop_products') {
                 if ($this->config['redshop_categories'] != -1 && file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_redshop')) {
                     $rs_mode = true;
                     $producthelper = new producthelper();
                     $redhelper = new redhelper();
                 } else {
                     // exception when RedSHOP is not installed
                     $this->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "discount_price" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => array());
                 }
             } elseif ($this->config["data_source"] == 'vm_categories' || $this->config["data_source"] == 'vm_products') {
                 if ($this->config['vm_categories'] != -1) {
                     $vm_mode = true;
                 } else {
                     // exception when VirtueMart is not installed
                     $this->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "price_currency" => array(), "discount_amount" => array(), "discount_is_percent" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => 0);
                 }
             }
         }
         // tables which will be used in generated content
         $news_list_tab = array();
         $news_html_tab = array();
         // Generating content
         $uri =& JURI::getInstance();
         $li_counter = 0;
         $news_k2_store = '';
         $news_header = '';
         $news_image = '';
         $news_readmore = '';
         $news_textt = '';
         $news_infoo = '';
         $news_infoo2 = '';
         //
         for ($i = 0; $i < count($this->content["ID"]); $i++) {
             if ($i < $this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages']) {
                 // GENERATING NEWS CONTENT
                 if ($k2_mode == FALSE && $rs_mode == FALSE && $vm_mode == FALSE) {
                     // GENERATING HEADER
                     if ($this->config['news_header_enabled'] == 1) {
                         $news_header = $renderer->header($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i]);
                     }
                     // GENERATING IMAGE
                     if ($this->config['news_image_enabled'] == 1) {
                         $news_image = $renderer->image($this->config, $uri, $this->content['ID'][$i], $this->content['IID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $this->content['title'][$i], $this->content['images'][$i]);
                     }
                     // GENERATING READMORE
                     if ($this->config['news_readmore_enabled'] == 1) {
                         $news_readmore = $renderer->readMore($this->config, $this->content['ID'][$i], $this->content['CID'][$i]);
                     }
                     // GENERATING TEXT
                     if ($this->config['news_text_enabled'] == 1) {
                         $news_textt = $renderer->text($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore);
                     }
                     // GENERATE NEWS INFO
                     if ($this->config['news_info_enabled'] == 1) {
                         $news_infoo = $renderer->info($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['author'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['rating_count'][$i], $this->content['rating_sum'][$i]);
                     }
                     // GENERATE NEWS INFO2
                     if ($this->config['news_info2_enabled'] == 1) {
                         $news_infoo2 = $renderer->info($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['author'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['rating_count'][$i], $this->content['rating_sum'][$i], 2);
                     }
                 } else {
                     if ($rs_mode == FALSE && $vm_mode == FALSE && $k2_mode == TRUE) {
                         // GENERATING HEADER
                         if ($this->config['news_header_enabled'] == 1) {
                             $news_header = $renderer->header_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['title'][$i]);
                         }
                         // GENERATING IMAGE
                         if ($this->config['news_image_enabled'] == 1) {
                             $news_image = $renderer->image_k2($this->config, $uri, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['text'][$i], $this->content['title'][$i]);
                         }
                         // GENERATING READMORE
                         if ($this->config['news_readmore_enabled'] == 1) {
                             $news_readmore = $renderer->readMore_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i]);
                         }
                         // GENERATING TEXT
                         if ($this->config['news_text_enabled'] == 1) {
                             $news_textt = $renderer->text_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['text'][$i], $news_readmore);
                         }
                         // GENERATE NEWS INFO
                         if ($this->config['news_info_enabled'] == 1) {
                             $news_infoo = $renderer->info_k2($this->config, $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['author'][$i], $this->content['author_id'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['alias'][$i], $this->content['comments'], $this->content['rating_count'][$i], $this->content['rating_sum'][$i]);
                         }
                         // GENERATE NEWS INFO2
                         if ($this->config['news_info2_enabled'] == 1) {
                             $news_infoo2 = $renderer->info_k2($this->config, $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['author'][$i], $this->content['author_id'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['alias'][$i], $this->content['comments'], $this->content['rating_count'][$i], $this->content['rating_sum'][$i], 2);
                         }
                         // GENERATE STORE BLOCK
                         $news_k2_store = $renderer->store_k2($this->config, $this->content['ID'][$i], $this->content['plugins'][$i], $this->k2store_params);
                     } else {
                         if ($rs_mode == TRUE && $vm_mode == FALSE && $k2_mode == FALSE) {
                             $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $this->content['ID'][$i]);
                             $id = $this->content['ID'][$i];
                             $cid = $producthelper->getCategoryProduct($this->content['ID'][$i]);
                             $Itemid = $redhelper->getItemid($this->content['ID'][$i]);
                             $product = $producthelper->getProductById($this->content['ID'][$i]);
                             // GENERATING HEADER
                             if ($this->config['news_header_enabled'] == 1) {
                                 $news_header = $renderer->header_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $Itemid);
                             }
                             // GENERATING IMAGE
                             if ($this->config['news_image_enabled'] == 1) {
                                 $news_image = $renderer->image_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['product_image'][$i], $this->content['title'][$i], $Itemid);
                             }
                             // GENERATING READMORE
                             if ($this->config['news_readmore_enabled'] == 1) {
                                 $news_readmore = $renderer->readMore_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $Itemid);
                             }
                             // GENERATING TEXT
                             if ($this->config['news_text_enabled'] == 1) {
                                 $news_textt = $renderer->text_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore, $Itemid);
                             }
                             // GENERATE NEWS INFO
                             if ($this->config['news_info_enabled'] == 1) {
                                 $news_infoo = $renderer->info_rs($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $Itemid, $this->content['manufacturer_id'][$i], 1);
                             }
                             // GENERATE NEWS INFO2
                             if ($this->config['news_info2_enabled'] == 1) {
                                 $news_infoo2 = $renderer->info_rs($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $Itemid, $this->content['manufacturer_id'][$i], 2);
                             }
                             // COMPUTE PRICE DEPENDS OF USER ID
                             $user =& JFactory::getUser();
                             $price = $producthelper->getProductPrice($this->content['ID'][$i], $this->config['rs_price_with_vat'], $user->id);
                             $price = $producthelper->getProductFormattedPrice($price, true);
                             if ($this->config['rs_add_to_cart'] == 1) {
                                 $addToCart = $producthelper->replaceCartTemplate($this->content['ID'][$i], 0, 0, 0, "", false, array(), 0, 0, 0);
                                 $addToCart = str_replace('&', '&amp;', $addToCart);
                                 if ($this->config['rs_show_default_cart_button'] == 0) {
                                     $btnCode = '<a class=\'nspAddToCart\' onclick="if(displayAddtocartForm(\'addtocart_prd_' . $this->content['ID'][$i];
                                     $btnCode .= '\',\'' . $id . '\',\'0\',\'0\', \'user_fields_form\'))';
                                     $btnCode .= '{checkAddtocartValidation(\'addtocart_prd_' . $id . '\',\'' . $id . '\',\'0\',\'0\', \'user_fields_form\',\'0\',\'0\',\'0\');}"><span style=\'cursor: pointer;\' id=\'pdaddtocartprd' . $id . '\' title=\'\' class=\'\'>' . JText::_('MOD_NEWS_PRO_GK4_ADD_TO_CART') . '</span></a>';
                                     $addToCart = preg_replace('/\\<img.*?\\>/i', $btnCode, $addToCart);
                                 }
                             }
                             // GET THE CURRENCY
                             $bool = preg_match('/[^0-9]/u', $price, $currency);
                             $currency = $currency[0];
                             $bool = preg_match('/[0-9]+/u', $price, $price);
                             $price = $price[0];
                             // GENERATE RedSHOP STORE INFO
                             $news_rs_store = $renderer->store_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $price, $this->content['discount_start'][$i], $this->content['discount_end'][$i], $this->content['tax'][$i], $this->content['discount_price'][$i], $currency, $Itemid, $addToCart);
                         } else {
                             if ($vm_mode == TRUE) {
                                 // GENERATING HEADER
                                 if ($this->config['news_header_enabled'] == 1) {
                                     $news_header = $renderer->header_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i]);
                                 }
                                 // GENERATING IMAGE
                                 if ($this->config['news_image_enabled'] == 1) {
                                     $news_image = $renderer->image_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['product_image'][$i], $this->content['title'][$i]);
                                 }
                                 // GENERATING READMORE
                                 if ($this->config['news_readmore_enabled'] == 1) {
                                     $news_readmore = $renderer->readMore_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i]);
                                 }
                                 // GENERATING TEXT
                                 if ($this->config['news_text_enabled'] == 1) {
                                     $news_textt = $renderer->text_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore);
                                 }
                                 // GENERATE NEWS INFO
                                 if ($this->config['news_info_enabled'] == 1) {
                                     $news_infoo = $renderer->info_vm($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['comments']);
                                 }
                                 // GENERATE NEWS INFO2
                                 if ($this->config['news_info2_enabled'] == 1) {
                                     $news_infoo2 = $renderer->info_vm($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['comments'], 2);
                                 }
                                 $news_vm_store = $renderer->store_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['price'][$i], $this->content['price_currency'][$i], $this->content['discount_amount'][$i], true, $this->content['discount_start'][$i], $this->content['discount_end'][$i], $this->content['tax'][$i], $this->content['manufacturer_id'][$i]);
                             }
                         }
                     }
                 }
                 // PARSING PLUGINS
                 if ($this->config['parse_plugins'] == TRUE) {
                     $news_textt = JHtml::_('content.prepare', $news_textt);
                 }
                 // CLEANING PLUGINS
                 if ($this->config['clean_plugins'] == TRUE) {
                     $news_textt = preg_replace("/(\\{.+?\\}.+?\\{.+?})|(\\{.+?\\})/", "", $news_textt);
                 }
                 // GENERATE CONTENT FOR TAB
                 $news_generated_content = '';
                 // initialize variable
                 //
                 for ($j = 1; $j < 7; $j++) {
                     if ($this->config['wrapContent'] == 1 && $this->config['news_image_order'] == 1) {
                         if ($j == 2) {
                             $news_generated_content .= '<div class="gkArtContentWrap">';
                         }
                     }
                     if ($this->config['news_header_order'] == $j) {
                         $news_generated_content .= $news_header;
                     }
                     if ($this->config['news_image_order'] == $j) {
                         $news_generated_content .= $news_image;
                     }
                     if ($this->config['news_text_order'] == $j) {
                         $news_generated_content .= $news_textt;
                     }
                     if ($this->config['news_info_order'] == $j) {
                         $news_generated_content .= $news_infoo;
                     }
                     if ($this->config['news_info2_order'] == $j) {
                         $news_generated_content .= $news_infoo2;
                     }
                     if ($this->config['news_rs_store_enabled'] != 'disabled') {
                         if ($rs_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_rs_store;
                         }
                         if ($vm_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_vm_store;
                         }
                         if ($k2_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_k2_store;
                         }
                     }
                 }
                 //
                 if ($this->config['news_content_readmore_pos'] != 'after') {
                     $news_generated_content .= $news_readmore;
                 }
                 if ($this->config['wrapContent'] == 1 && $this->config['news_image_order'] == 1) {
                     $news_generated_content .= '</div>';
                 }
                 // creating table with news content
                 array_push($news_html_tab, $news_generated_content);
             } else {
                 if ($k2_mode == FALSE && $vm_mode == FALSE) {
                     array_push($news_list_tab, $renderer->lists($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 } elseif ($k2_mode == TRUE) {
                     array_push($news_list_tab, $renderer->lists_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 } else {
                     array_push($news_list_tab, $renderer->lists_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 }
                 //
                 $li_counter++;
             }
         }
         /** GENERATING FINAL XHTML CODE START **/
         // create instances of basic Joomla! classes
         $document = JFactory::getDocument();
         $uri = JURI::getInstance();
         // add stylesheets to document header
         if ($this->config["useCSS"] == 1) {
             $document->addStyleSheet($uri->root() . 'modules/mod_news_pro_gk4/interface/css/style.css', 'text/css');
         }
         // add script to the document header
         if ($this->config['useScript'] == 1) {
             $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js');
         }
         // init $headData variable
         $headData = false;
         // add scripts with automatic mode to document header
         if ($this->config['useScript'] == 2) {
             // getting module head section datas
             unset($headData);
             $headData = $document->getHeadData();
             // generate keys of script section
             $headData_keys = array_keys($headData["scripts"]);
             // set variable for false
             $engine_founded = false;
             // searching phrase mootools in scripts paths
             if (array_search($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js', $headData_keys) > 0) {
                 $engine_founded = true;
             }
             // if engine doesn't exists in the head section
             if (!$engine_founded) {
                 // add new script tag connected with mootools from module
                 $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js');
             }
         }
         //
         require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'content');
         require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'default');
     }
 }
Esempio n. 30
0
 public function newsletterEntry($data)
 {
     $db = JFactory::getDbo();
     $newsletter_id = $data['default_newsletter'];
     $mailfrom = $data['news_mail_from'];
     $mailfromname = $data['news_from_name'];
     $to = $data['newsletter_test_email'];
     $producthelper = new producthelper();
     $uri = JURI::getInstance();
     $url = $uri->root();
     // Getting newsletter content
     $newsbody = $this->getnewsletter_content($newsletter_id);
     $subject = "";
     $newsletter_body = "";
     $newsletter_template = "";
     if (count($newsbody) > 0) {
         $subject = $newsbody[0]->subject;
         $newsletter_body = $newsbody[0]->body;
         $newsletter_template = $newsbody[0]->template_desc;
     }
     $o = new stdClass();
     $o->text = $newsletter_body;
     JPluginHelper::importPlugin('content');
     $dispatcher = JDispatcher::getInstance();
     $x = array();
     $results = $dispatcher->trigger('onPrepareContent', array(&$o, &$x, 0));
     $newsletter_template2 = $o->text;
     $content = str_replace("{data}", $newsletter_template2, $newsletter_template);
     $product_id_list = $this->getProductIdList();
     for ($i = 0; $i < count($product_id_list); $i++) {
         $product_id = $product_id_list[$i]->product_id;
         if (strstr($content, '{redshop:' . $product_id . '}')) {
             $content = str_replace('{redshop:' . $product_id . '}', "", $content);
         }
         if (strstr($content, '{Newsletter Products:' . $product_id . '}')) {
             $product_id = $product_id_list[$i]->product_id;
             $newsproductbody = $this->getnewsletterproducts_content();
             $np_temp_desc = $newsproductbody[0]->template_desc;
             $thum_image = "";
             if ($product_id_list[$i]->product_full_image) {
                 $thumbUrl = RedShopHelperImages::getImagePath($product_id_list[$i]->product_full_image, '', 'thumb', 'product', PRODUCT_MAIN_IMAGE, PRODUCT_MAIN_IMAGE, USE_IMAGE_SIZE_SWAPPING);
                 $thum_image = "<a id='a_main_image' href='" . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $product_id_list[$i]->product_full_image . "' title='' rel=\"lightbox[product7]\">";
                 $thum_image .= "<img id='main_image' src='" . $thumbUrl . "'>";
                 $thum_image .= "</a>";
             }
             $np_temp_desc = str_replace("{product_thumb_image}", $thum_image, $np_temp_desc);
             $np_temp_desc = str_replace("{product_price}", $producthelper->getProductFormattedPrice($product_id_list[$i]->product_price), $np_temp_desc);
             $np_temp_desc = str_replace("{product_name}", $product_id_list[$i]->product_name, $np_temp_desc);
             $np_temp_desc = str_replace("{product_desc}", $product_id_list[$i]->product_desc, $np_temp_desc);
             $np_temp_desc = str_replace("{product_s_desc}", $product_id_list[$i]->product_s_desc, $np_temp_desc);
             $content = str_replace("{Newsletter Products:" . $product_id . "}", $np_temp_desc, $content);
         }
     }
     // Replacing the Text library texts
     $texts = new text_library();
     $content = $texts->replace_texts($content);
     // If the template contains the images, then revising the path of the images,
     // So the full URL goes with the mail, so images are visible in the mails.
     $data1 = $data = $content;
     preg_match_all("/\\< *[img][^\\>]*[.]*\\>/i", $data, $matches);
     $imagescurarray = array();
     foreach ($matches[0] as $match) {
         preg_match_all("/(src|height|width)*= *[\"\\']{0,1}([^\"\\'\\ \\>]*)/i", $match, $m);
         $images[] = array_combine($m[1], $m[2]);
         $imagescur = array_combine($m[1], $m[2]);
         $imagescurarray[] = $imagescur['src'];
     }
     $imagescurarray = array_unique($imagescurarray);
     if ($imagescurarray) {
         foreach ($imagescurarray as $change) {
             if (strpos($change, 'http') === false) {
                 $data1 = str_replace($change, $url . $change, $data1);
             }
         }
     }
     $to = trim($to);
     $today = time();
     // Replacing the tags with the values
     $name = explode('@', $to);
     $query = "INSERT INTO `" . $this->_table_prefix . "newsletter_tracker` " . "(`tracker_id`, `newsletter_id`, `subscription_id`, `subscriber_name`, `user_id` , `read`, `date`)  " . "VALUES ('', '" . $newsletter_id . "', '0', '" . $name . "', '0',0, '" . $today . "')";
     $db->setQuery($query);
     $db->query();
     $content = '<img  src="' . $url . 'components/com_redshop/helpers/newsletteropener.php?tracker_id=' . $db->insertid() . '" />';
     $content .= str_replace("{username}", $name[0], $data1);
     $content = str_replace("{email}", $to, $content);
     if (JUtility::sendMail($mailfrom, $mailfromname, $to, $subject, $content, 1)) {
         return true;
     }
     return false;
 }