Jump to content

fs_xyz

Members
  • Posts

    68
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

fs_xyz's Achievements

Newbie

Newbie (1/14)

2

Reputation

  1. If you need to set more rules, you can use this : //this part to prevent multi 'add to cart' button usage on the same product and //to prevent input bigger than your limit when inputing number of purchase switch ($this->id_product) { case 1: //example of product id, change to any number you want if ($this->qty > 1) //you can change 1 to any number you want as product limit $this->errors[] = Tools::displayError('This product is limited to one quantity in purchase', !Tools::getValue('ajax')); break; case 2: if ($this->qty > 1) $this->errors[] = Tools::displayError('This product is limited to one quantity in purchase', !Tools::getValue('ajax')); break; case 3: if ($this->qty > 1) $this->errors[] = Tools::displayError('This product is limited to one quantity in purchase', !Tools::getValue('ajax')); break; } //if you need more items, just re-do one of those 'case' command. //this part to disable 'plus' button on checkout page if the number went bigger or user change the number //you will need the same number of 'case' command depend on previous usage. $db = Db::getInstance(); switch ($this->id_product) { case 1: $result = $db->getValue(' SELECT quantity as pur_num FROM '._DB_PREFIX_.'cart_product WHERE id_product = 1 AND id_cart = '.$this->context->cart->id); if ($result>=1) $this->errors[] = Tools::displayError('This product is limited to one quantity in purchase', !Tools::getValue('ajax')); break; case 2: $result = $db->getValue(' SELECT quantity as pur_num FROM '._DB_PREFIX_.'cart_product WHERE id_product = 2 AND id_cart = '.$this->context->cart->id); if ($result>=1) $this->errors[] = Tools::displayError('This product is limited to one quantity in purchase', !Tools::getValue('ajax')); break; case 3: $result = $db->getValue(' SELECT quantity as pur_num FROM '._DB_PREFIX_.'cart_product WHERE id_product = 3 AND id_cart = '.$this->context->cart->id); if ($result>=1) $this->errors[] = Tools::displayError('This product is limited to one quantity in purchase', !Tools::getValue('ajax')); break; } Well, this modification is useful to those who only require small amount of items require this purchase rule. For those with larger, you might need module for this.
  2. Hi, Not sure if this is the correct section. Just wanted to contribute something with modification which I managed to do. This is about limiting purchase of an item. For example in the code is product with product id = 2, and the limit is 1. If you're not sure with what is your product id, you can see the list from catalog->product menu at admin page under 'ID' column. The modification is in file controllers/front/CartController.php. The modification worked for 1.5 and 1.6. Find this function around line 190 ish. protected function processChangeProductInCart() { $mode = (Tools::getIsset('update') && $this->id_product) ? 'update' : 'add'; if ($this->qty == 0) $this->errors[] = Tools::displayError('Null quantity.', !Tools::getValue('ajax')); elseif (!$this->id_product) $this->errors[] = Tools::displayError('Product not found', !Tools::getValue('ajax')); I put modification to become : protected function processChangeProductInCart() { $mode = (Tools::getIsset('update') && $this->id_product) ? 'update' : 'add'; //this is to prevent user to multiple click 'add to cart' button and add more than 1 when inputing number of purchase if (($this->qty > 1) && ($this->id_product == 2)) $this->errors[] = Tools::displayError('This product is limited to one quantity in purchase', !Tools::getValue('ajax')); //this one is for checkout page where this will disable plus button upon press and produce message when pressed if (($this->context->cart->id) && ($this->id_product == 2)) { $db = Db::getInstance(); $result = $db->getValue(' SELECT quantity as pur_num FROM '._DB_PREFIX_.'cart_product WHERE id_product = 2 AND id_cart = '.$this->context->cart->id); if ($result>=1) $this->errors[] = Tools::displayError('This product is limited to one quantity in purchase', !Tools::getValue('ajax')); } if ($this->qty == 0) $this->errors[] = Tools::displayError('Null quantity.', !Tools::getValue('ajax')); elseif (!$this->id_product) $this->errors[] = Tools::displayError('Product not found', !Tools::getValue('ajax')); Hopefully, this can help. Sorry for bad english, not my 1st language.
  3. For some reason, if your text in description or short description contain the word "trigger" or the like, it will produce this kind of error. Don't know why.
  4. No luck in trying. Seem like I cannot get this working if the customer haven't log in yet. If only login part initiated before displaying summary..... that might work. But I don't know how to make it work.
  5. I'm sorry for very late replay.... got stuck with high work hour. I think I misinform you about : $smarty->display(PS_MODULE_DIR.'cashondelivery/'.'validation.tpl'); ( this line is located in display payment function ) Not PS_MODULE_DIR but _PS_MODULE_DIR_ Please note the underscore placement. It should work and will bring you straight to cash on delivery module. Of course only if the user already log in before.
  6. At admin->shipping tab, make sure you re-save handling and fees table. Also maximize price range and weight range.
  7. It should not cause you any problem as long as the database and working directory remain separated. I tried running 2 prestashop install. One as main, one as test subject for change. No problem at all... but it might cause you headache during prestashop upgrade/backup.
  8. Make sure he/she log in 1st and your carrier setting don't have anything wrong... otherwise this won't work. Root folder/order.php line 85 : case 1 displayPayment(); ( remove displayAddress() ) Still in the same file, search for function displayPayment(). Search this line : $smarty->display(_PS_THEME_DIR_.'order-payment.tpl'); replace it with : $smarty->display(_PS_MODULE_DIR_.'cashondelivery/'.'validation.tpl'); Open up your validation.tpl inside your cash on delivery module. Find this line : convertPrice price=$total Replace it with : convertPrice price=$total_price ( yeah, just add word _price there... ) Find this line : {$base_dir_ssl}order.php?step= Replace the number after step= with 0. For arranging looks so login/address/shipping become unclick able. Go into your themes folder, find order-steps.tpl. Add <!-- at beginning of line 13 and then add --> at the end of line 39 Hope it help...
  9. Yes, you're correct in this one, I always assume that user should log in 1st before start clicking... I'll try to look again.
  10. Version 1.2.4 : At admin page, go to Stat tab --> go to product detail at navigation panel ( left bottom area )
  11. At your root directory file order.php. At line 85, you'll see script written with switch blahblahblah. Below it there is case 1 : displayAddress(). Block that line with // and write another line to be like this case 1: displayPayment(); //displayAddress(); break; This will make user go straight to payment choice. At order-steps.tpl, inside your themes directory, line 22, add <!-- and end with --> at line 39 <!-- {if $current_step=='payment' || $current_step=='shipping'} {l s='Address'} {else} {l s='Address'} {/if} --> <!-- {if $current_step=='payment'} {l s='Shipping'} {else} {l s='Shipping'} {/if} --> Now other steps are disabled. Lastly, order-payment.tpl also inside your themes directory. Go to line 24, check this line : {$base_dir_ssl}order.php?step=2 Change 2 to 0, this will make back button at payment choose screen revert to the cart list. This probably work very good if you only have 1 carrier as set up... dunno with multiple carrier tough, since skipping carrier choice will automatically choose your default carrier. On you problem for shipping problem : Admin shipping tab --> countries, zones, carriers : Make sure a customer country available for the carrier. Admin shipping tab --> price ranges : Make sure the max number price range is high enough. ( I think it is limited to 10,000,000 ) Admin shipping tab --> re-save both top handling and fees table. ( yes, re-save those.... ) Hope it help...
  12. Thank you for your explanation. What I intend to accomplish now is finished !!!! Finally a dynamic flash which can read working folder and module folder !!!! Mwahahahahahahah !!!! <---gone nutty I think I saw the light..... <---gone to afterlife
  13. Bump again. Ugh... how to use variable $module_dir inside flash ? *.tpl can just call it easily, how to post this variable into flash ? I tried to use text or another tpl file as a bridge, but end up in a failure..... ( or due to lack of my understanding to create a module... )
  14. Bump, please help, I really don't have any clue on how to do such thing.
  15. Sorry if this was posted at wrong forum. I need to know on how to export some setting to xml and flash. For example, I want to variable $module_dir which contain directory modules address so I can set it inside my .xml and .fla file. So when loaded, those xml and flash file can use this variable to locate directory module automatically. Right now, I need to modificate both xml and flash file manually just because of address issue. Can become more problematic for future update. I'm not an advanced programmer so I might end up requiring step by step procedure. Or if anyone know from where I can learn this stuff, please post the link.
×
×
  • Create New...