$related_template_data = str_replace("{relproduct_number}", $related_product[$r]->product_number, $related_template_data); $related_template_data = str_replace("{relproduct_s_desc}", $rp_shortdesc, $related_template_data); $related_template_data = str_replace("{relproduct_desc}", $rpdesc, $related_template_data); $manufacturer = $producthelper->getSection("manufacturer", $related_product[$r]->manufacturer_id); if (count($manufacturer) > 0) { $man_url = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=products&mid=' . $related_product[$r]->manufacturer_id . '&Itemid=' . $this->itemId); $manufacturerLink = "<a href='" . $man_url . "'>" . JText::_("COM_REDSHOP_VIEW_ALL_MANUFACTURER_PRODUCTS") . "</a>"; $related_template_data = str_replace("{manufacturer_name}", $manufacturer->manufacturer_name, $related_template_data); $related_template_data = str_replace("{manufacturer_link}", $manufacturerLink, $related_template_data); } else { $related_template_data = str_replace("{manufacturer_name}", '', $related_template_data); $related_template_data = str_replace("{manufacturer_link}", '', $related_template_data); } // Show Price if (!$related_product[$r]->not_for_sale) { $related_template_data = $producthelper->GetProductShowPrice($related_product[$r]->product_id, $related_template_data, '', 0, 1); } else { $related_template_data = str_replace("{price_excluding_vat}", '', $related_template_data); $related_template_data = str_replace("{relproduct_price_table}", '', $related_template_data); $related_template_data = str_replace("{relproduct_price_novat}", '', $related_template_data); $related_template_data = str_replace("{relproduct_old_price}", '', $related_template_data); $related_template_data = str_replace("{relproduct_old_price_lbl}", '', $related_template_data); $related_template_data = str_replace("{relproduct_price_saving_lbl}", '', $related_template_data); $related_template_data = str_replace("{relproduct_price_saving}", '', $related_template_data); $related_template_data = str_replace("{relproduct_price}", '', $related_template_data); } // End Show Price $relmorelinkhref = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $related_product[$r]->product_id . '&cid=' . $related_product[$r]->cat_in_sefurl . '&Itemid=' . $this->itemId); $relmorelink = 'javascript:window.parent.SqueezeBox.close();window.parent.location.href="' . $relmorelinkhref . '"'; $rmore = "<a href='" . $relmorelink . "' title='" . $related_product[$r]->product_name . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>"; $related_template_data = str_replace("{read_more}", $rmore, $related_template_data);
public function sendWishlist($post) { $user = JFactory::getUser(); $redshopMail = new redshopMail(); $redhelper = new redhelper(); $wishlist_id = JRequest::getInt('wishlist_id'); $emailto = $post['emailto']; $sender = $post['sender']; $email = $post['email']; $subject = $post['subject']; $Itemid = $post['Itemid']; $producthelper = new producthelper(); // Get data from database if not than fetch from session if ($user->id && $wishlist_id) { $query = "SELECT DISTINCT w.* ,p.* FROM " . $this->_table_prefix . "wishlist AS w " . "LEFT JOIN " . $this->_table_prefix . "wishlist_product AS pw ON w.wishlist_id=pw.wishlist_id " . "LEFT JOIN " . $this->_table_prefix . "product AS p ON p.product_id = pw.product_id " . "WHERE w.user_id = " . (int) $user->id . " " . "AND w.wishlist_id = " . (int) $wishlist_id . " "; } else { // Add this code to send wishlist while user is not loged in ... $prod_id = ""; for ($add_i = 1; $add_i < $_SESSION["no_of_prod"]; $add_i++) { $prod_id .= (int) $_SESSION['wish_' . $add_i]->product_id . ","; } $prod_id .= (int) $_SESSION['wish_' . $add_i]->product_id; $query = "SELECT DISTINCT p.* FROM " . $this->_table_prefix . "product AS p " . "WHERE p.product_id IN (" . $prod_id . ")"; } $MyWishlist = $this->_getList($query); $i = 0; $data = ""; $mailbcc = null; $wishlist_body = $redshopMail->getMailtemplate(0, "mywishlist_mail"); if (count($wishlist_body) > 0) { $wishlist_body = $wishlist_body[0]; $data = $wishlist_body->mail_body; $subject = $wishlist_body->mail_subject; if (trim($wishlist_body->mail_bcc) != "") { $mailbcc = explode(",", $wishlist_body->mail_bcc); } } if ($data) { $template_d1 = explode("{product_loop_start}", $data); $template_d2 = explode("{product_loop_end}", $template_d1[1]); $wishlist_desc = $template_d2[0]; if (strstr($data, '{product_thumb_image_2}')) { $tag = '{product_thumb_image_2}'; $h_thumb = THUMB_HEIGHT_2; $w_thumb = THUMB_WIDTH_2; } elseif (strstr($data, '{product_thumb_image_3}')) { $tag = '{product_thumb_image_3}'; $h_thumb = THUMB_HEIGHT_3; $w_thumb = THUMB_WIDTH_3; } elseif (strstr($data, '{product_thumb_image_1}')) { $tag = '{product_thumb_image_1}'; $h_thumb = THUMB_HEIGHT; $w_thumb = THUMB_WIDTH; } else { $tag = '{product_thumb_image}'; $h_thumb = THUMB_HEIGHT; $w_thumb = THUMB_WIDTH; } $temp_template = ''; if (count($MyWishlist)) { foreach ($MyWishlist as $row) { $Itemid = $redhelper->getItemid($row->product_id); $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . (int) $Itemid, true, -1); $thum_image = $producthelper->getProductImage($row->product_id, $link, $w_thumb, $h_thumb); $pname = $row->product_name; $pname = $pname; $wishlist_data = str_replace($tag, $thum_image, $wishlist_desc); $wishlist_data = str_replace('{product_name}', $pname, $wishlist_data); // Attribute ajax change if (!$row->not_for_sale) { $wishlist_data = $producthelper->GetProductShowPrice($row->product_id, $wishlist_data); } else { $wishlist_data = str_replace("{product_price}", "", $wishlist_data); $wishlist_data = str_replace("{price_excluding_vat}", "", $wishlist_data); $wishlist_data = str_replace("{product_price_table}", "", $wishlist_data); $wishlist_data = str_replace("{product_old_price}", "", $wishlist_data); $wishlist_data = str_replace("{product_price_saving}", "", $wishlist_data); } $temp_template .= $wishlist_data; } } $data = $template_d1[0] . $temp_template . $template_d2[1]; $name = @explode('@', $emailto); $data = str_replace('{from}', $sender, $data); $data = str_replace('{name}', $name[0], $data); $data = str_replace('{from_name}', $sender, $data); $data_add = $data; } else { if (count($MyWishlist)) { $link = JURI::root() . "index.php?tmpl=component&option=com_redshop&view=account&layout=mywishlist&mail=1"; foreach ($MyWishlist as $row) { $data_add .= '<div class="redProductWishlist">'; $thum_image = ""; $pname = $row->product_name; $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid); $thum_image = $producthelper->getProductImage($row->product_id, $link, THUMB_WIDTH, THUMB_HEIGHT); $data_add .= $thum_image; $pname = "<div><a href='" . $link . "' >" . $pname . "</a></div>"; $data_add .= $pname; $formatted_price = $producthelper->GetProductShowPrice($row->product_id, $wishlist_data); // For attribute price count $price_add = '<span id="pr_price">' . $formatted_price . '</span>'; $i++; $data_add .= '</div>'; } } } if (JFactory::getMailer()->sendMail($email, $sender, $emailto, $subject, $data_add, true, null, $mailbcc)) { return true; } else { return false; } }