chucurulo Posted September 22, 2015 Share Posted September 22, 2015 Saludos, anexo una imagen me gustaria saber cual es la variable del precio final del producto. - la del precio base ya la consegui es la siguiente: wholesale_price - la del precio final cual es ???? gracias por su ayuda. Link to comment Share on other sites More sharing options...
shacker Posted September 23, 2015 Share Posted September 23, 2015 price_tax_incl Link to comment Share on other sites More sharing options...
chucurulo Posted September 23, 2015 Author Share Posted September 23, 2015 price_tax_incl gracias shacker agradecido estoy tratando de hacer una consulta con de SQL, y necesito el precio final de cada producto con descuento incluido. paro ahora veo que esa variable no esta en la tabla de prudut en la base de datos. por ejemplo: wholesale_price (esta en la table "p." la agrego de esta manera "p.wholesale_price") price_tax_incl (en que tablet se encuentra??) espero su ayuda. Link to comment Share on other sites More sharing options...
shacker Posted September 23, 2015 Share Posted September 23, 2015 usa la funcion Tools::displayPrice(Product::getPriceStatic($veri['id_product'], $usetax = true, $veri4['id_product_attribute'] = null, $decimals = 2, $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = true, $id_customer, $id_cart = null, $id_address, $specificPriceOutput = null, $with_ecotax = true, $use_groupReduction = true, $context = null, $use_customer_price = true)); solo llama a la variable con el id del producto $veri['id_product'] y usetax en true Link to comment Share on other sites More sharing options...
chucurulo Posted September 23, 2015 Author Share Posted September 23, 2015 (edited) gracias nuevamente shacker resulta que yo le he agregado 2 nuevas columnas la a seccion de cantidades disponible para que me muestre el stock valorizado y la ganancias que tengo acualmente en stock, todo me funciona perfecto lo unico que la parte de PRECIO VENTA, no he podido agregar el precio final del producto con descuento. solo consigo agregar el precio de venta sin los descuento ni iva esa es la parte que quiero solucionar, aqui le dejo el codigo y una imagen funcionando actualmente a ver si me ayuda un poco gracias de ante manos <?php /* * 2007-2014 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) exit; class StatsStock extends Module { private $html = ''; public function __construct() { $this->name = 'statsstock'; $this->tab = 'analytics_stats'; $this->version = '1.4.1'; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Available quantities'); $this->description = 'Adds a tab showing the quantity of available products for sale to the Stats dashboard.'; $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); } public function install() { return parent::install() && $this->registerHook('AdminStatsModules'); } public function hookAdminStatsModules() { if (Tools::isSubmit('submitCategory')) $this->context->cookie->statsstock_id_category = Tools::getValue('statsstock_id_category'); $ru = AdminController::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token'); $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $filter = ((int)$this->context->cookie->statsstock_id_category ? ' AND p.id_product IN (SELECT cp.id_product FROM '._DB_PREFIX_.'category_product cp WHERE cp.id_category = '.(int)$this->context->cookie->statsstock_id_category.')' : ''); $sql = 'SELECT p.id_product, p.reference, pl.name, pl.name, p.price, IFNULL(( SELECT AVG(product_attribute_shop.wholesale_price) FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa').' WHERE p.id_product = pa.id_product AND product_attribute_shop.wholesale_price != 0 ), product_shop.wholesale_price) as wholesale_price, IFNULL(stock.quantity, 0) as quantity FROM '._DB_PREFIX_.'product p '.Shop::addSqlAssociation('product', 'p').' INNER JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('pl').') '.Product::sqlStock('p', 0).' WHERE 1 = 1 '.$filter; $products = Db::getInstance()->executeS($sql); foreach ($products as $key => $p) $products[$key]['stockvalue'] = $p['wholesale_price'] * $p['quantity']; foreach ($products as $key => $p) $products[$key]['stockvaluea'] = $p['price'] * $p['quantity']; foreach ($products as $key => $p) $products[$key]['ganancia'] = $p['stockvaluea'] - $p['stockvalue']; $this->html .= ' <script type="text/javascript">$(\'#calendar\').slideToggle();</script> <div class="panel-heading">' .$this->l('Evaluation of available quantities for sale'). '</div> <form action="'.Tools::safeOutput($ru).'" method="post" class="form-horizontal"> <div class="row row-margin-bottom"> <label class="control-label col-lg-3">'.$this->l('Category').'</label> <div class="col-lg-6"> <select name="statsstock_id_category" onchange="this.form.submit();"> <option value="0">- '.$this->l('All').' -</option>'; foreach (Category::getSimpleCategories($this->context->language->id) as $category) $this->html .= '<option value="'.(int)$category['id_category'].'" '. ($this->context->cookie->statsstock_id_category == $category['id_category'] ? 'selected="selected"' : '').'>'. $category['name'].' </option>'; $this->html .= ' </select> <input type="hidden" name="submitCategory" value="1" /> </div> </div> </form>'; if (!count($products)) $this->html .= '<p>'.$this->l('Your catalog is empty.').'</p>'; else { $rollup = array('quantity' => 0, 'price' => 0, 'stockvaluea' => 0); $rollup = array('quantity' => 0, 'wholesale_price' => 0, 'stockvalue' => 0); $this->html .= ' <table class="table"> <thead> <tr> <th><span class="title_box active">'.$this->l('ID').'</span></th> <th><span class="title_box active">'.$this->l('Ref.').'</span></th> <th><span class="title_box active">'.$this->l('Item').'</span></th> <th><span class="title_box active">'.$this->l('Available quantity for sale').'</span></th> <th><span class="title_box active">'.$this->l('Price*').'</span></th> <th><span class="title_box active">'.$this->l('Value').'</span></th> <th><span class="title_box active">'.$this->l('precio veta').'</span></th> <th><span class="title_box active">'.$this->l('Total Venta').'</span></th> </tr> </thead> <tbody>'; foreach ($products as $product) { $rollup['quantity'] += $product['quantity']; $rollup['wholesale_price'] += $product['wholesale_price']; $rollup['stockvalue'] += $product['stockvalue']; $rollup['stockvaluea'] += $product['stockvaluea']; $rollup['price'] += $product['price']; $rollup['ganancia'] += $product['ganancia']; $this->html .= '<tr> <td>'.$product['id_product'].'</td> <td>'.$product['reference'].'</td> <td>'.$product['name'].'</td> <td>'.$product['quantity'].'</td> <td>'.Tools::displayPrice($product['wholesale_price'], $currency).'</td> <td>'.Tools::displayPrice($product['stockvalue'], $currency).'</td> <td>'.Tools::displayPrice($product['price'], $currency).'</td> <td>'.Tools::displayPrice($product['stockvaluea'], $currency).'</td> </tr>'; } $this->html .= ' </tbody> <tfoot> <tr> <th colspan="3"></th> <th><span class="title_box active">'.$this->l('Total quantities').'</span></th> <th><span class="title_box active">'.$this->l('Average price').'</span></th> <th><span class="title_box active">'.$this->l('Total value').'</span></th> <th><span class="title_box active">'.$this->l('Total Precio').'</span></th> <th><span class="title_box active">'.$this->l('Total precio venta').'</span></th> </tr> <tr> <td colspan="3"></td> <td>'.$rollup['quantity'].'</td> <td>'.Tools::displayPrice($rollup['wholesale_price'] / count($products), $currency).'</td> <td>'.Tools::displayPrice($rollup['stockvalue'], $currency).'</td> <td>'.Tools::displayPrice($rollup['price'] / count($products), $currency).'</td> <td>'.Tools::displayPrice($rollup['stockvaluea'], $currency).'</td> </tr> <th><span class="text">'.$this->l('GANANCIAS ESTIMADAS').'</span></th> <td>'.Tools::displayPrice($rollup['ganancia'], $currency).'</td> </tfoot> </table> <i class="icon-asterisk"></i> '.$this->l('This section corresponds to the default wholesale price according to the default supplier for the product. An average price is used when the product has attributes.'); return $this->html; } } } Edited September 23, 2015 by chucurulo (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted September 24, 2015 Share Posted September 24, 2015 Usa la funcion getSpecificPrice para obtener el descuento de cualquier precio (specificprice.php) getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0, $id_cart = 0, $real_quantity = 0) Link to comment Share on other sites More sharing options...
chucurulo Posted September 24, 2015 Author Share Posted September 24, 2015 gracias shacker nuevamente yo inserte la funcion en el codido tal como me la paso public function hookAdminStatsModules() { if (Tools::isSubmit('submitCategory')) $this->context->cookie->statsstock_id_category = Tools::getValue('statsstock_id_category'); $getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0, $id_cart = 0, $real_quantity = 0) $ru = AdminController::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token'); $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $filter = ((int)$this->context->cookie->statsstock_id_category ? ' AND p.id_product IN (SELECT cp.id_product FROM '._DB_PREFIX_.'category_product cp WHERE cp.id_category = '.(int)$this->context->cookie->statsstock_id_category.')' : ''); $sql = 'SELECT p.id_product, p.reference, pl.name, pl.name, IFNULL(( SELECT AVG(product_attribute_shop.wholesale_price) FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa').' WHERE p.id_product = pa.id_product AND product_attribute_shop.wholesale_price != 0 y me lanza este error, disculpe es que no soy tan diestro en esto, soy poco novato. Parse error: syntax error, unexpected '$ru' (T_VARIABLE) in /home/dominio/public_html/prueba/modules/statsstock/statsstock.php on line 61 Link to comment Share on other sites More sharing options...
shacker Posted September 27, 2015 Share Posted September 27, 2015 te da error aqui $ru = AdminController::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token'); deberias quitarlo y ver si da otro error Link to comment Share on other sites More sharing options...
chucurulo Posted October 12, 2015 Author Share Posted October 12, 2015 te da error aqui $ru = AdminController::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token'); deberias quitarlo y ver si da otro error amigo por mas que e intentado no he podido obtener resultados. para ver si me entiende lo que quiero hacer en PS en la parte de Estadisticas / Cantidades Disponibles. en la columna PRECIO esta refleja el precio de almacen (precio costo), lo que quiero es cambiarlo por el precio final del producto el que se muestra a lo clientes en la pagina. si puede pegar el codigo o el archivo statsstock.php con la modificacion del l modulo que solo sea copiar mucho mejor, porque ya me he complicado mucho y soy novato gracias de antemanos y pacienca Link to comment Share on other sites More sharing options...
shacker Posted October 14, 2015 Share Posted October 14, 2015 el precio que te pase toma el precio con el iva, eso deberia funcionarte: $miprecio = Tools::displayPrice(Product::getPriceStatic($veri['id_product'], $usetax = true, $veri4['id_product_attribute'] = null, $decimals = 2, $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = true, $id_customer, $id_cart = null, $id_address, $specificPriceOutput = null, $with_ecotax = true, $use_groupReduction = true, $context = null, $use_customer_price = true)); $usetax = true es lo que le agrega la tasa al precio y $miprecio es la variable con ese precio Link to comment Share on other sites More sharing options...
chucurulo Posted October 14, 2015 Author Share Posted October 14, 2015 el precio que te pase toma el precio con el iva, eso deberia funcionarte: $miprecio = Tools::displayPrice(Product::getPriceStatic($veri['id_product'], $usetax = true, $veri4['id_product_attribute'] = null, $decimals = 2, $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = true, $id_customer, $id_cart = null, $id_address, $specificPriceOutput = null, $with_ecotax = true, $use_groupReduction = true, $context = null, $use_customer_price = true)); $usetax = true es lo que le agrega la tasa al precio y $miprecio es la variable con ese precio Saludos, shaker, gracias nuevamente. nos se si estoy haciendo algo mal o si introduzco el codigo donde no debe ir pero aun no me funciona, te diejo el codigo completo para que le heche un vistaso si no es mucha molestia statsstock.php Link to comment Share on other sites More sharing options...
chucurulo Posted November 13, 2015 Author Share Posted November 13, 2015 aun sigo sin resolver, no he podido con este tema Link to comment Share on other sites More sharing options...
shacker Posted December 5, 2015 Share Posted December 5, 2015 deberia funcionar. habilita el display errors en el defines.inc.php a ver si da algun error Link to comment Share on other sites More sharing options...
chucurulo Posted December 5, 2015 Author Share Posted December 5, 2015 shacker saludos, podria publicar el php completo con la modificacion realizada funcionando por favor del archivo /public_html/dominio/modules/statsstock/statsstock.php muchas gracias.. Link to comment Share on other sites More sharing options...
chucurulo Posted February 25, 2016 Author Share Posted February 25, 2016 (edited) deberia funcionar. habilita el display errors en el defines.inc.php a ver si da algun error Saludos, aun no he podido lograr lo que quiero active el modo de errores, agrege la linea tal y como me la paso $miprecio = Tools::displayPrice(Product::getPriceStatic($veri['id_product'], $usetax = true, $veri4['id_product_attribute'] = null, $decimals = 2, $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = true, $id_customer, $id_cart = null, $id_address, $specificPriceOutput = null, $with_ecotax = true, $use_groupReduction = true, $context = null, $use_customer_price = true)); ME LANZA ESTE ERROR Notice: Undefined variable: veri in /home/prueba/public_html/prueba/modules/statsstock/statsstock.php on line 63 Notice: Undefined variable: id_customer in /home/prueba/public_html/prueba/modules/statsstock/statsstock.php on line 63 Notice: Undefined variable: id_address in /home/prueba/public_html/prueba/modules/statsstock/statsstock.php on line 63 Strict Standards: Only variables should be passed by reference in /home/prueba/public_html/prueba/modules/statsstock/statsstock.php on line 63 Fatal error Edited February 25, 2016 by chucurulo (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted February 26, 2016 Share Posted February 26, 2016 las variables $veri['id_product'], debe ser el id del producto, que en tu codigo creo que debes camiar veri por product $product['id_product'] y todos los que diga veri o verix por product Link to comment Share on other sites More sharing options...
chucurulo Posted February 26, 2016 Author Share Posted February 26, 2016 las variables $veri['id_product'], debe ser el id del producto, que en tu codigo creo que debes camiar veri por product $product['id_product'] y todos los que diga veri o verix por product Gracias nuevamente shacker. realize indicado ahora otro error diferente. podria publicar el php con la modificacion realizada funcionando por favor del archivo /public_html/dominio/modules/statsstock/statsstock.php se trata de la parte en PS --Estadistica / cantidades disponibles -- los productos muestran el precio de almacen y quiro sustituirlo por el precio final del producto. Ya llevo varios meses y aun no he encontrado la solucion Notice: Undefined variable: id_customer in /home/fundiazu/public_html/prueba/modules/statsstock/statsstock.php on line 83 Notice: Undefined variable: id_address in /home/fundiazu/public_html/prueba/modules/statsstock/statsstock.php on line 83 Strict Standards: Only variables should be passed by reference in /home/fundiazu/public_html/prueba/modules/statsstock/statsstock.php on line 83 Fatal error Link to comment Share on other sites More sharing options...
shacker Posted April 3, 2016 Share Posted April 3, 2016 eso es por que debes pasar las variables sin el = por ejemplo en vez de $specificPriceOutput = null pon null solamente Link to comment Share on other sites More sharing options...
chucurulo Posted April 22, 2016 Author Share Posted April 22, 2016 eso es por que debes pasar las variables sin el = por ejemplo en vez de $specificPriceOutput = null pon null solamente gracias por la shacker por la paciencia, y ayuda. pero aun sigue el error, puede usted hacer alguna prueba con la modificaciones y publicarla funcionando aqui por favor, seria de gran ayuda ya que es mucho el tiempo que le le he dedicado a esta parte sin poder resolvera y soy un poco novato en estos asuntos. gracias nuevamente Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now