Jump to content

rubensaid

Members
  • Posts

    29
  • Joined

  • Last visited

About rubensaid

  • Birthday 05/17/1992

Profile Information

  • Location
    Lima, Perú

Recent Profile Visitors

558 profile views

rubensaid's Achievements

Newbie

Newbie (1/14)

7

Reputation

2

Community Answers

  1. El error en 1.7.6.7 es que falta agregar paréntesis en la regla que evalua si un producto ya tiene descuento o no. La solución es usar esta línea de código, en reemplazo del que viene por defecto en: /src/Core/Cart/CartRuleCalculator.php Buscar al rededor de la línea 166 // Discount (%) on the selection of products // MODIFIED BY RUBEN FELIX // Se agregaron parentesis en la linea 174 y 175 para aislar las consultas in_array, y en conjunto operarlas con las reglas de verificacion de otros descuentos if ($cartRule->reduction_percent && $cartRule->reduction_product == -2) { $selected_products = $cartRule->checkProductRestrictionsFromCart($cart, true); if (is_array($selected_products)) { foreach ($this->cartRows as $cartRow) { $product = $cartRow->getRowData(); if ((in_array($product['id_product'] . '-' . $product['id_product_attribute'], $selected_products) || in_array($product['id_product'] . '-0', $selected_products)) && (($cartRule->reduction_exclude_special && !$product['reduction_applies']) || !$cartRule->reduction_exclude_special)) { $amount = $cartRow->applyPercentageDiscount($cartRule->reduction_percent); $cartRuleData->addDiscountApplied($amount); } } } } Este es un ejemplo de como quedo en mi web. La regla que cree pide que exista el producto "Azodyl" y otro producto "Renal". El descuento es 10% sobre estos productos, pero se debe excluir a "Azodyl" que el el que tendrá el descuento publicado. Y como se ve, la regla funciona. Se generá un descuento llamado Pack Tratamiento Renal que de 34.20 PEN (En el extracto también se está sumando otro descuento por "Canbo" de 10 PEN, siendo un total de 44.20 PEN de descuento en esta orden)
  2. You can modify the javascript of that module in order to get actual GPS position of user
  3. This is a valuable contribution. Thank you so much @target46k2
  4. I found that in some themes JS this sentence is used: Look for themes/yourtheme/js/modules/loyality/loyality.js or something similar. You can use debug tools of browsers. updateLoyaltyView(parseInt($('#our_price_display').text())); Which produces error in some currencies. So, changed it to this: updateLoyaltyView(parseInt($('#our_price_display').attr("content")));
  5. that should be a problem with your theme, because that piece of code just fix a problem with logical code no related to visuals or smarty.
  6. I'm using this code. Is almost the same, but just I'm making sure that code will not call to getProduct() function when CompareController is the context. However, js and css will load on both pages public function hookDisplayHeader($params) { if (!isset($this->context->controller->php_self) || !in_array($this->context->controller->php_self, array('product', 'products-comparison'))) return; $this->context->controller->addCss($this->_path.'css/socialsharing.css'); $this->context->controller->addJS($this->_path.'js/socialsharing.js'); if(in_array($this->context->controller->php_self, array('product'))) $product = $this->context->controller->getProduct(); if (!Validate::isLoadedObject($product)) { return; }
  7. Yo lo estoy utilizando algo asi: public function hookDisplayHeader($params) { if (!isset($this->context->controller->php_self) || !in_array($this->context->controller->php_self, array('product', 'products-comparison'))) return; $this->context->controller->addCss($this->_path.'css/socialsharing.css'); $this->context->controller->addJS($this->_path.'js/socialsharing.js'); if(in_array($this->context->controller->php_self, array('product'))) $product = $this->context->controller->getProduct(); if (!Validate::isLoadedObject($product)) { return; }
  8. This is an override, we are not modifying core files directly. If you read developers manuals, you will see that Prestashop mention using overrides to change default behaviour.
  9. That problem was fixed with this line: https://github.com/PrestaShop/PrestaShop/commit/966c24d5d49d1269f854b338ce9ac95235a6268e
  10. Hola ditolas, que problema sucede al tratar de utilizar el script? Sabes si sube imagenes también, o como maneja ese punto? Yo también necesito un script como este, sería genial para mi marketplace. Quisiera conocer que problemas estas teniendo pues segun el post de referencia es basicamente utilizar un archivo ya hecho de prestashop.
  11. I haven't been using it on my site. But I will be use finally. I just developed code becasue I though I would use it but finally desist.. however, now I have to use it .. LOL
  12. this is for manufacturer, but for supplier not. I've been checking new Supplier.php file of new version of Prestashop on GitHub but code is the same, I think the problem wasn't fixe
  13. Ok, I've found the solution. Just have to use this code for product and id_product $product = $this->context->controller->getProduct(); $id_product = (int)$product->id; And this one for category: $category = $this->context->controller->getCategory(); if (!isset($category->id_category)) { if (isset($product->id_category_default) && $product->id_category_default > 1) $category = new Category((int)$product->id_category_default); }
  14. Hi Prestashoppers! I'm trying to do some modifications to ProductsCategory module, which shows products in the same category in product page. To achieve this goal I've edited this file: modules/productscategory/productscategory.php Briefly, I copied the code of public function hookProductFooter($params) and create the function for Right Column hook. The function I've created is the following. I've just modified the quantity of products, cache id and added a new varaible ($category) for smarty. public function hookRightColumn($params) { $id_product = (int)$params['product']->id; $product = $params['product']; $cache_id = 'productscategory_side|'.$id_product.'|'.(isset($params['category']->id_category) ? (int)$params['category']->id_category : (int)$product->id_category_default); if (!$this->isCached('productscategory_side.tpl', $this->getCacheId($cache_id))) { $category = false; if (isset($params['category']->id_category)) $category = $params['category']; else { if (isset($product->id_category_default) && $product->id_category_default > 1) $category = new Category((int)$product->id_category_default); } if (!Validate::isLoadedObject($category) || !$category->active) return false; // Get infos $category_products = $category->getProducts($this->context->language->id, 1, 12); /* 12 products max. */ $nb_category_products = (int)count($category_products); $middle_position = 0; // Remove current product from the list if (is_array($category_products) && count($category_products)) { foreach ($category_products as $key => $category_product) { if ($category_product['id_product'] == $id_product) { unset($category_products[$key]); break; } } $taxes = Product::getTaxCalculationMethod(); if (Configuration::get('PRODUCTSCATEGORY_DISPLAY_PRICE')) { foreach ($category_products as $key => $category_product) { if ($category_product['id_product'] != $id_product) { if ($taxes == 0 || $taxes == 2) { $category_products[$key]['displayed_price'] = Product::getPriceStatic( (int)$category_product['id_product'], true, null, 2 ); } elseif ($taxes == 1) { $category_products[$key]['displayed_price'] = Product::getPriceStatic( (int)$category_product['id_product'], false, null, 2 ); } } } } // Get positions $middle_position = (int)round($nb_category_products / 2, 0); $product_position = $this->getCurrentProduct($category_products, (int)$id_product); // Flip middle product with current product if ($product_position) { $tmp = $category_products[$middle_position - 1]; $category_products[$middle_position - 1] = $category_products[$product_position]; $category_products[$product_position] = $tmp; } // If products tab higher than 30, slice it if ($nb_category_products > 30) { $category_products = array_slice($category_products, $middle_position - 15, 30, true); $middle_position = 15; } } // Display tpl $this->smarty->assign( array( 'categoryProducts' => $category_products, 'middlePosition' => (int)$middle_position, 'category' => $category, /* Added by Ruben Felix */ 'ProdDisplayPrice' => Configuration::get('PRODUCTSCATEGORY_DISPLAY_PRICE') ) ); } return $this->display(__FILE__, 'productscategory_side.tpl', $this->getCacheId($cache_id)); } As you can see, this function use a different template for display. It uses productscategory_side.tpl which is a file I've created. This file exists both in themes/mytheme/modules/productscategory/ and modules/productscategory/views/templates/hook Content for this file is the following: <!-- MODULE Block products in the same category --> <!-- {if $categoryProducts && $categoryProducts|@count > 0} --> <div id="products-category_block_right" class="block products_block"> <h4 class="title_block"> <a href="{$category->getLink()|escape:'html'}" title="{l s='Products In The Same Category' mod='productscategory'}">{l s='Products In The Same Category' mod='productscategory'}</a> </h4> <div class="block_content"> {include file="$tpl_dir./product-list-home.tpl" products=$categoryProducts id="pc-block"} <script type="text/javascript"> $(document).ready(function(){ $("#pc-block").owlCarousel({ <!-- {if $categoryProducts|@count > 1} --> loop:true, autoplay: true, margin:10, nav:true, <!-- {else} loop:false, nav:false, {/if} --> responsive:{ 0:{ items:2, margin:0 }, 480:{ items:3, margin:0 }, 768:{ items:1, margin:0 }, 992:{ items:1, margin:0 }, 1200:{ items:1, margin:0 } } }) }); </script> </div> </div> <!-- {/if} --> <!-- /MODULE Block products in the same category --> This file is specific for the theme I use, which has included owl.carousel library. I've register the hook in displayRightColumn, delete the ProductFooter and Header hooks. I've tested module is loaded writing print "hola" at the beginning of the function and it was showed when loaded product page. I've also deactivated cache and force compilation temporary. Hope you can help me sorting this problem out. Regards. Ruben Felix Lima, Perú
×
×
  • Create New...