function shop_bk_products_show($options) { include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopproduct.class.php'; include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopfunctions.php'; $db = XoopsDatabaseFactory::getDatabaseConnection(); $limit = $options[2] > 0 ? $options[2] : 5; $ord = $options[0] <= 0 ? ' `created` DESC' : 'RAND()'; $mc = RMUtilities::module_config('shop', 'format'); if ($options[1] != '') { $tp = $db->prefix("shop_products"); $tc = $db->prefix("shop_categories"); $tcp = $db->prefix("shop_catprods"); $sql = "SELECT p.* FROM {$tp} as p, {$tcp} as r WHERE r.cat={$options['1']} AND p.id_product=r.product GROUP BY r.product"; } else { $sql = "SELECT * FROM " . $db->prefix("shop_products"); } $sql .= " ORDER BY {$ord} LIMIT 0,{$limit}"; $result = $db->query($sql); $products = array(); while ($row = $db->fetchArray($result)) { $prod = new ShopProduct(); $prod->assignVars($row); $products[] = array('id' => $prod->id(), 'name' => $prod->getVar('name'), 'link' => $prod->permalink(), 'price' => sprintf($mc, number_format($prod->getVar('price'), 2)), 'type' => $prod->getVar('type') ? __('Digital', 'shop') : 'Product', 'stock' => $prod->getVar('available'), 'image' => $prod->getVar('image')); } $block['products'] = $products; unset($prod, $products, $sql, $result, $row, $ord, $limit, $db); $block['show_image'] = $options[3]; $block['width'] = $options[4]; $block['height'] = $options[5]; $block['display'] = $options[6]; $block['name'] = in_array("name", $options); $block['price'] = in_array("price", $options); $block['type'] = in_array("type", $options); $block['stock'] = in_array("stock", $options); $block['lang_stock'] = __('In stock', 'shop'); $block['lang_nostock'] = __('Out of stock', 'shop'); // Add styles RMTemplate::get()->add_style('blocks.css', 'shop'); return $block; }
// $Id$ // -------------------------------------------------------------- // MiniShop 3 // Module for catalogs // Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- define('RMCLOCATION', 'dashboard'); include 'header.php'; RMTemplate::get()->add_head('<script type="text/javascript">var xurl="' . XOOPS_URL . '";</script>'); RMTemplate::get()->add_local_script('dashmain.js', 'shop'); RMTemplate::get()->add_style('admin.css', 'shop'); RMTemplate::get()->add_style('dashboard.css', 'shop'); $db = XoopsDatabaseFactory::getDatabaseConnection(); // Products count $sql = "SELECT COUNT(*) FROM " . $db->prefix("shop_products"); list($prods_count) = $db->fetchRow($db->query($sql)); $sql = "SELECT COUNT(*) FROM " . $db->prefix("shop_categories"); list($cats_count) = $db->fetchRow($db->query($sql)); $sql = "SELECT * FROM " . $db->prefix("shop_products") . " ORDER BY id_product DESC LIMIT 0, 5"; $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $prod = new ShopProduct(); $prod->assignVars($row); $products[] = array('id' => $prod->id(), 'name' => $prod->getVar('name'), 'link' => $prod->permalink(), 'image' => $prod->getVar('image')); } ShopFunctions::include_required_files(); xoops_cp_header(); include RMTemplate::get()->get_template('admin/shop_dashboard.php', 'module', 'shop'); xoops_cp_footer();
$xoopsMailer->setBody(sprintf(__('A user has requested more information about the product %s. User message below.', 'shop'), $product->getVar('name')) . "\n---------------\n" . $message . "\n--------------\n" . __('Message sent with MiniShop', 'shop') . "\n" . ShopFunctions::get_url()); $xoopsMailer->setToEmails($xoopsModuleConfig['email']); $xoopsMailer->setFromEmail($email); $xoopsMailer->setFromName($name); $xoopsMailer->setSubject(sprintf(__('Information request about product %s', 'shop'), $product->getVar('name'))); if (!$xoopsMailer->send(true)) { redirect_header($url, 1, __('Message could not be delivered. Please try again.', 'shop')); die; } redirect_header(ShopFunctions::get_url(), 1, __('Your message has been sent successfully!', 'shop')); } else { $xoopsOption['template_main'] = 'shop_contact.html'; include 'header.php'; $tf = new RMTimeFormatter(0, '%d%/%M%/%Y%'); // Product data $xoopsTpl->assign('product', array('name' => $product->getVar('name'), 'description' => $product->getVar('description'), 'price' => sprintf(__('Price: <strong>%s</strong>', 'shop'), sprintf($xoopsModuleConfig['format'], number_format($product->getVar('price'), 2))), 'type' => $product->getVar('type'), 'stock' => $product->getVar('available'), 'image' => $product->getVar('image'), 'created' => sprintf(__('Since: <strong>%s</strong>', 'shop'), $tf->format($product->getVar('created'))), 'updated' => $product->getVar('modified') > 0 ? sprintf(__("Updated: <strong>%s</strong>", 'shop'), $tf->format($product->getVar('modified'))) : '', 'link' => $product->permalink(), 'metas' => $product->get_meta(), 'images' => $product->get_images())); $categories = array(); ShopFunctions::categos_list($categories); array_walk($categories, 'shop_dashed'); $xoopsTpl->assign('categories_list', $categories); $xoopsTpl->assign('lang_selcat', __('Select category...', 'shop')); $xoopsTpl->assign('xoops_pagetitle', sprintf(__('Requesting information about %s', 'shop'), $product->getVar('name')) . ' » ' . $xoopsModuleConfig['modtitle']); $xoopsTpl->assign('lang_requesting_info', sprintf(__('Request Information for %s', 'shop'), $product->getVar('name'))); $xoopsTpl->assign('lang_yname', __('Your Name:', 'shop')); $xoopsTpl->assign('lang_ymail', __('Your Email:', 'shop')); $xoopsTpl->assign('lang_prod', __('Product:', 'shop')); $xoopsTpl->assign('lang_message', __('Message:', 'shop')); $xoopsTpl->assign('lang_send', __('Send Message', 'shop')); $xoopsTpl->assign('form_action', RMFunctions::current_url()); if ($xoopsUser) { $xoopsTpl->assign('shop_name', $xoopsUser->name());