Jump to content

vivek tripathi

Members
  • Content count

    87
  • Joined

  • Last visited

About vivek tripathi

  • Rank
    PrestaShop Apprentice
  • Birthday 01/07/1983

Profile Information

  • Gender
    Male
  • Location
    Delhi, India
  • Interests
    Prestashop Module, and responsive theme design,
    Custome , Core modification in prestashop and wordpress
  • Activity
    Developer

Contact Methods

  • Skype
    vivek.kr.tripathi

Recent Profile Visitors

6,836,659 profile views
  1. Multicurrency store wrong attributes calculation

    Hi All, I was also facing this problem prestashop new release having some bug I hope prestashop team member should resolve these issue before they move for next version release. I don't when they will do . but I have got solution myself by overriding product controller. Process Methode first -------------------------------------------------------------------------- Edit Product controller Open file - controllers -> front- >ProductController.php find code near Line no 445 $combinations[$row['id_product_attribute']]['price'] = (float)$row['price']; Replace With $combinations[$row['id_product_attribute']]['price'] = (float)Tools::convertPrice($row['price'],Context::getContext()->currency); Methode 2 By Overriding Product controller Go to location override\controllers\front\ Create New File name ProductController.php and Write code given below <?php class ProductController extends ProductControllerCore { protected function assignAttributesGroups() { $colors = array(); $groups = array(); // @todo (RM) should only get groups and not all declination ? $attributes_groups = $this->product->getAttributesGroups($this->context->language->id); if (is_array($attributes_groups) && $attributes_groups) { $combination_images = $this->product->getCombinationImages($this->context->language->id); $combination_prices_set = array(); foreach ($attributes_groups as $k => $row) { // Color management if (isset($row['is_color_group']) && $row['is_color_group'] && (isset($row['attribute_color']) && $row['attribute_color']) || (file_exists(_PS_COL_IMG_DIR_ . $row['id_attribute'] . '.jpg'))) { $colors[$row['id_attribute']]['value'] = $row['attribute_color']; $colors[$row['id_attribute']]['name'] = $row['attribute_name']; if (!isset($colors[$row['id_attribute']]['attributes_quantity'])) $colors[$row['id_attribute']]['attributes_quantity'] = 0; $colors[$row['id_attribute']]['attributes_quantity'] += (int) $row['quantity']; } if (!isset($groups[$row['id_attribute_group']])) $groups[$row['id_attribute_group']] = array( 'group_name' => $row['group_name'], 'name' => $row['public_group_name'], 'group_type' => $row['group_type'], 'default' => -1, ); $groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = $row['attribute_name']; if ($row['default_on'] && $groups[$row['id_attribute_group']]['default'] == -1) $groups[$row['id_attribute_group']]['default'] = (int) $row['id_attribute']; if (!isset($groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']])) $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] = 0; $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] += (int) $row['quantity']; $combinations[$row['id_product_attribute']]['attributes_values'][$row['id_attribute_group']] = $row['attribute_name']; $combinations[$row['id_product_attribute']]['attributes'][] = (int) $row['id_attribute']; $combinations[$row['id_product_attribute']]['price'] = (float)Tools::convertPrice($row['price'],Context::getContext()->currency); // Call getPriceStatic in order to set $combination_specific_price if (!isset($combination_prices_set[(int) $row['id_product_attribute']])) { Product::getPriceStatic((int) $this->product->id, false, $row['id_product_attribute'], 6, null, false, true, 1, false, null, null, null, $combination_specific_price); $combination_prices_set[(int) $row['id_product_attribute']] = true; $combinations[$row['id_product_attribute']]['specific_price'] = $combination_specific_price; } $combinations[$row['id_product_attribute']]['ecotax'] = (float) $row['ecotax']; $combinations[$row['id_product_attribute']]['weight'] = (float) $row['weight']; $combinations[$row['id_product_attribute']]['quantity'] = (int) $row['quantity']; $combinations[$row['id_product_attribute']]['reference'] = $row['reference']; $combinations[$row['id_product_attribute']]['unit_impact'] = $row['unit_price_impact']; $combinations[$row['id_product_attribute']]['minimal_quantity'] = $row['minimal_quantity']; if ($row['available_date'] != '0000-00-00') { $combinations[$row['id_product_attribute']]['available_date'] = $row['available_date']; $combinations[$row['id_product_attribute']]['date_formatted'] = Tools::displayDate($row['available_date']); } else $combinations[$row['id_product_attribute']]['available_date'] = ''; if (!isset($combination_images[$row['id_product_attribute']][0]['id_image'])) $combinations[$row['id_product_attribute']]['id_image'] = -1; else { $combinations[$row['id_product_attribute']]['id_image'] = $id_image = (int) $combination_images[$row['id_product_attribute']][0]['id_image']; if ($row['default_on']) { if (isset($this->context->smarty->tpl_vars['cover']->value)) $current_cover = $this->context->smarty->tpl_vars['cover']->value; if (is_array($combination_images[$row['id_product_attribute']])) { foreach ($combination_images[$row['id_product_attribute']] as $tmp) if ($tmp['id_image'] == $current_cover['id_image']) { $combinations[$row['id_product_attribute']]['id_image'] = $id_image = (int) $tmp['id_image']; break; } } if ($id_image > 0) { if (isset($this->context->smarty->tpl_vars['images']->value)) $product_images = $this->context->smarty->tpl_vars['images']->value; if (isset($product_images) && is_array($product_images) && isset($product_images[$id_image])) { $product_images[$id_image]['cover'] = 1; $this->context->smarty->assign('mainImage', $product_images[$id_image]); if (count($product_images)) $this->context->smarty->assign('images', $product_images); } if (isset($this->context->smarty->tpl_vars['cover']->value)) $cover = $this->context->smarty->tpl_vars['cover']->value; if (isset($cover) && is_array($cover) && isset($product_images) && is_array($product_images)) { $product_images[$cover['id_image']]['cover'] = 0; if (isset($product_images[$id_image])) $cover = $product_images[$id_image]; $cover['id_image'] = (Configuration::get('PS_LEGACY_IMAGES') ? ($this->product->id . '-' . $id_image) : (int) $id_image); $cover['id_image_only'] = (int) $id_image; $this->context->smarty->assign('cover', $cover); } } } } } // wash attributes list (if some attributes are unavailables and if allowed to wash it) if (!Product::isAvailableWhenOutOfStock($this->product->out_of_stock) && Configuration::get('PS_DISP_UNAVAILABLE_ATTR') == 0) { foreach ($groups as &$group) foreach ($group['attributes_quantity'] as $key => &$quantity) if ($quantity <= 0) unset($group['attributes'][$key]); foreach ($colors as $key => $color) if ($color['attributes_quantity'] <= 0) unset($colors[$key]); } foreach ($combinations as $id_product_attribute => $comb) { $attribute_list = ''; foreach ($comb['attributes'] as $id_attribute) $attribute_list .= '\'' . (int) $id_attribute . '\','; $attribute_list = rtrim($attribute_list, ','); $combinations[$id_product_attribute]['list'] = $attribute_list; } $this->context->smarty->assign(array( 'groups' => $groups, 'colors' => (count($colors)) ? $colors : false, 'combinations' => $combinations, 'combinationImages' => $combination_images )); } } } ?> or Download ProductController.php and place in override folder ProductController.php
  2. [Solved] Overriding class in Prestashop 1.5.5

    you can even override class from module in PSv1.5+
  3. How to fix the birthday present module

    Code change to show Type option in birthdaypresent Module Inside your birthdaypresent module create folder override/classess and then create file Discount.php write code class Discount extends DiscountCore { public static function getDiscountTypes($id_lang) { $x=array( 1 =>array('id_discount_type'=>'1','name'=>'Discount on order (%)'), 2 =>array('id_discount_type'=>'2','name'=>'Discount on order (amount)'), 3 =>array('id_discount_type'=>'3','name'=>'Free shiping') ); return $x; } } Step 2- uninstall module and then reinstall Note if still not working then please remove/delete file cache/class_index.php and uninstall and install module it will work and Type option will be visible overAll mean to say override the class Discount since in version 1.5+ getDiscountTypes function not present Second Method ----------------------------------- Replace $discountTypes = Discount::getDiscountTypes((int)($cookie->id_lang)); with the $discountTypes = array( 1 =>array('id_discount_type'=>'1','name'=>'Discount on order (%)'), 2 =>array('id_discount_type'=>'2','name'=>'Discount on order (amount)'), 3 =>array('id_discount_type'=>'3','name'=>'Free shiping') );
  4. Many Thanks It very good module It save my few hour thanks again
  5. Override does not work for Product.php Class (v 1.5.2)

    Many Thanks Big_Berny, you found the solution for me . I removed file cache/class_index.php and it working... It is really helpful for me it is just similar to life saving help. It doesn't matter you have enabled cache or not. I found after each time you override class or controller you have to delete that file to take effect of overriding once you run site that file automatically generated that having record of all your core as well as overridden controller and class file details. If you are changing in same overridden class/ controller you don't need to delete file again and again.
  6. MODULE "PRODUCT QUESTION"

    Hi All I have checked many times this module even I have checked it for Prestashop version 1.5.2.0 to 1.5.4.0 its working properly and and emails are coming please ad email address at module configure section where you want to send email Please also check your shop email system is working properly by going to admin-> Advance parameter -> email and check by sending test email to same email id where product enquiry emails are going One Issue can be arise different language than English If you guys are using different language other than English please make folder of you language in module->productenquiry->mail-> [your language folder name] for example for french make folder name fr and copy en folder content into them. if you are still facing an issue you. I can check it for you if you share admin and ftp details.
  7. Hi I have got crack to increse attachment name length for prestashop version 1.5.4 STEP 1 Go to classes/Attachment.php find the code near line no 50 'name' =>array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), Replacede with 'name' =>array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128), STEP 2 go to controllers\admin\AdminProductsController.php Find the function processAddAttachments() inside that fuction find code near line no 463 elseif (Tools::strlen(Tools::getValue('attachment_name_'.(int)($language['id_lang']))) > 32) $this->errors[] = sprintf(Tools::displayError('The name is too long (%d chars max).'), 32); Replace width elseif (Tools::strlen(Tools::getValue('attachment_name_'.(int)($language['id_lang']))) >128) $this->errors[] = sprintf(Tools::displayError('The name is too long (%d chars max).'), 128); STEP 3 Open database table ps_attachment_lang change name field varchar(32) to varchar(128)
  8. Hi I am using prestashop version 1.5.4 solution mentioned in this post is not working
  9. MODULE "PRODUCT QUESTION"

    Hi All Here is the module for product Enquiry / Product Question working well with the Prestashop version 1.5.4.0 tested This modules ads an link similar to send to friend module on click a Enquiry form will open when user fills that form and submit an email goes to Email specified from back end of this module if email not specified Email will goes to default shop email id productenquiry.zip
  10. Hi, In order to block category only to show current category from lv1 open file \themes\{THEMEfolder name}\js\tools\treeManagement.js if any theme installed or if defualt theme then open themes\default\js\tools\treeManagement.js Edit function function toggleBranch(jQueryElement, noAnimation) { if(jQueryElement.hasClass('OPEN')) closeBranch(jQueryElement, noAnimation); else openBranch(jQueryElement, noAnimation); } Replaced with function toggleBranch(jQueryElement, noAnimation) { closeBranch($('.OPEN'), noAnimation); if(jQueryElement.hasClass('OPEN')) closeBranch(jQueryElement, noAnimation); else openBranch(jQueryElement, noAnimation); }
  11. rollover image in product list

    Hi , I found a very good module on following http://www.marghoobsuleman.com/prestashop-modules/prestashop-modules-image-enlarger I think it will meet your requirement
  12. Hi Here is Home featured rollover image code and file tested on version 1.4+ This contain small modification in original prestashop homefeatured module. you can achieve roll over image functionality by following these simple steps or replace homefeatured.php and homefeatured.tpl with attached files this is not complete module it contains only two file homefeatured.php and homefeatured.tpl STEP 1 Replace following line in homefeatured.tpl <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" class="vky"/> Replace with --- {* ---- modified portion to show rollover image on home featured product start here *} <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" class="vky"/> {foreach from=$addimages key=k item=v} {if $k==$product.id_product} <img src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$v, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.legend|escape:htmlall:'UTF-8'}" style="display:none" class="v" /> {/if} {/foreach} {* ---- modified portion to show rollover image on home featured product End here *} STEP2 add following js at the end of page {* additional jquery code to rollover image on home featured product *} {literal} <script type="text/javascript"> $(document).ready(function(){ $("img.vky").mouseover(function(){ if ( $(this).next("img").length > 0 ) { $(this).next("img").show(); $(this).hide(); } }); $(".v").mouseout(function(){ $(this).hide(); $(this).prev("img").show(); }); }); </script> {/literal} STEP3 homefeatured.php < Replace following code in function hookHome($params) near line no 99 > $products = $category->getProducts((int)($params['cookie']->id_lang), 1, ($nb ? $nb : 10)); Replace with the code $products = $category->getProducts((int)($params['cookie']->id_lang), 1, ($nb ? $nb : 10)); $p=array(); for($i=0;$i<count($products);$i++){ $product=$products[$i]; unset ($pid); $pid=$product['id_product']; $sql= "SELECT * FROM `"._DB_PREFIX_."image` WHERE `id_product` = '{$pid}' AND cover = '0' ORDER BY `id_image` "; $results = Db::getInstance()->ExecuteS($sql); $result=$results[0]; $p[$pid]=$result['id_image']; } $smarty->assign('addimages',$p); Note- some time it is possible editor parse some code. It will be better to download files attached below homefeatured-rooloverimages-file.zip
  13. Error: Unable To Save Update Quantity

    add following line theme->prestashop->js-> cart-summary.js in $(document).ready(function() baseDir="yoursite.com"
  14. Many thanks to babywok it works fine
  15. Hi All First of all thanks to ningu for your code I have add small peace of code to run above code in both condition ajaxcart is activate or deactivated (jquery code in product-listing.tpl file) Here is complete code below some time editor parse code so for convinece I have attached text file having complete code in theme->prodcut-list.tpl Replace {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} with the following code {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Quantity :'} <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> {l s='Add to cart'} {else} In the module->blockcart->ajax-cart.js ajaxCart.add(idProduct, null, false, this); Replace with ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); In theme->product-list.tpl add following lin at the top of page {literal} <script type="text/javascript"> $(document).ready(function(){ $(".ajax_add_to_cart_button").click(function(){ var f=$(this).attr('href'); var id = f.split('&')[1].split('=')[1]; var p="#quantity_wanted_"+id; var qty=$(p).attr('value'); g=f+"&qty="+qty; window.location=''+g; return false; }); }); </script> {/literal}
×