private function add_product_shipping_methods($product_rows) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $model_options = WDFHelper::get_model('options'); $options = $model_options->get_options(); $decimals = $options->option_show_decimals == 1 ? 2 : 0; $row_default_currency = WDFDb::get_row('currencies', $db->quoteName('default') . ' = 1'); for ($i = 0; $i < count($product_rows); $i++) { $product_row = $product_rows[$i]; $query->clear(); $query->select('T_SHIPPING_METHODS.name'); $query->select('T_SHIPPING_METHODS.description'); $query->select('T_SHIPPING_METHODS.price'); $query->select('T_SHIPPING_METHODS.free_shipping'); $query->select('T_SHIPPING_METHODS.free_shipping_start_price'); $query->from('#__ecommercewd_productshippingmethods AS T_PRODUCT_SHIPPING_METHODS'); $query->leftJoin('#__ecommercewd_shippingmethods AS T_SHIPPING_METHODS ON T_PRODUCT_SHIPPING_METHODS.shipping_method_id = T_SHIPPING_METHODS.id'); $query->where('T_PRODUCT_SHIPPING_METHODS.product_id = ' . $product_row->id); $query->where('T_SHIPPING_METHODS.published = 1'); $query->order('T_SHIPPING_METHODS.ordering ASC'); $db->setQuery($query); $shipping_method_rows = $db->loadObjectList(); if ($db->getErrorNum()) { return false; } // additional data foreach ($shipping_method_rows as $shipping_method_row) { // prices $shipping_method_row->price = $shipping_method_row->free_shipping == 1 ? 0 : $shipping_method_row->price; // number format and currency signs if ($shipping_method_row->price != 0) { $shipping_method_row->price_text = number_format($shipping_method_row->price, $decimals); if ($row_default_currency->sign_position == 0) { $shipping_method_row->price_text = $row_default_currency->sign . $shipping_method_row->price_text; } else { $shipping_method_row->price_text = $shipping_method_row->price_text . $row_default_currency->sign; } } else { $shipping_method_row->price_text = WDFText::get('FREE_SHIPPING'); } } $product_row->shipping_methods = $shipping_method_rows; } }
private function sent_review_notification_email($product_id) { $app = JFactory::getApplication(); $joomla_config = JFactory::getConfig(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $model_options = WDFHelper::get_model('options'); $options = $model_options->get_options(); // get admin email $admin_email = $options->registration_administrator_email; //get product row $product_row = WDFHelper::get_model()->get_product_view_product_row($product_id); // mail data $mail_data = array(); $mail_data['mailfrom'] = JMailHelper::isEmailAddress($admin_email) == true ? $admin_email : $joomla_config->get('mailfrom'); $mail_data['sitename'] = $joomla_config->get('sitename'); $mail_data['subject'] = WDFText::get('EMAIL_REVIEW_NOTIFICATION_TO_ADMIN'); $mail_data['body'] = WDFText::get('EMAIL_REVIEW_NOTIFICATION_TO_ADMIN_BODY', $product_row->name, $mail_data['sitename']); //send mail to admins $query->clear(); $query->select('name'); $query->select('email'); $query->select('sendEmail'); $query->from('#__users'); $query->where('sendEmail = 1'); $db->setQuery($query); $admin_rows = $db->loadObjectList(); foreach ($admin_rows as $admin_row) { WDFMail::send_mail($mail_data['mailfrom'], $admin_row->email, $mail_data['subject'], $mail_data['body'], true); } }