Jump to content

ukvapeclub

Members
  • Posts

    16
  • Joined

  • Last visited

Profile Information

  • Activity
    User/Merchant

ukvapeclub's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Hi guys and girls, I'm looking for a way to perform an action based on whether a customer uses a particular cart rule when they place an order. For example, if a customer places an order which has the cart rule "XYZ" applied to it, then alter their account details in some way. i.e. When validating order: if ($cartRule->code == "XYZ"){ //do some stuff } I'm just struggling to find at which point in the order controllers that this would take place. Any help much appreciated, and I hope that made some sort of sense Stu Edit: I appreciate that the actual code would look nothing like the above
  2. I've recently done something like this, firstly you'll need to pass a variable to Smarty from whatever module you're playing with, for example: $this->cookie = new Cookie('psAdmin'); if (isset($this->cookie->id_employee) && $this->cookie->id_employee != ''){ $employee = new Employee($this->cookie->id_employee); if ( $employee->isSuperAdmin() ) { $this->context->smarty->assign('issuperadmin', true); } } Then you can use {if $issuperadmin}<DO SOME STUFF>{/if}in your template. Credit goes to the "Ninja Customer" module for this, that's what I based the above code on.
  3. I'm also having this problem, hoping someone can shed a little light on the subject
  4. Hi guys and girls, Sorry if this question has been asked a dozen times before but I can't see anything from a search. We've been running PS 1.6.0.13 for quite a while now and we're encountering problems with extremely long load times (sometimes over 30s) on certain pages in the Back Office (Customers and Orders especially). I'm guessing the first thing to do is to upgrade to the latest version of PS, however during the course of the last year or so we've made some tweaks to certain files (in classes, controllers) etc to customise our site. (Yes, I know there are better ways to do this but we're not coding genuises. Am I correct in assuming that if we were to upgrade then all our modified files would be overwritten by the default PS files, and to what extent? i.e. Will an update also affect files in the modules and themes folders, or just the main classes/controllers etc? Sorry if I'm asking a bit much but a bit of guidance would be greatly appreciated Thanks in advance. Stu
  5. Hi guys and girls, I'm having a slight problem with PayPal module 3.10.2 running on PS 1.6.0.13 A few of our orders have come through where the shipping fee hasn't been applied to the PayPal payment. Our customers have the option of free shipping or expedited shipping for £0.99 Looks like the issue happens if the customer selects the shipping option and then clicks the PayPal checkout button very quickly (within about 2 seconds). This results in (for example) a £9.99 order coming through when the customer has only paid £9.00 Any advice would be much appreciated, thanks in advance -Stu
  6. Hi guys and girls, This may be a straightforward question but I can't seem to make it happen. Basically I want the checkout page to prompt the customer to actually select a carrier, without automatically defaulting to one or the other. We currently have 2 carrier options (2nd Class Free, 1st Class £0.99) and the 2nd Class Free option is the default. I have tried altering order-carrier.tpl to set both radio buttons unchecked, but if neither is checked by the time the payment is processed, it still defaults to 2nd Class Free on the order. Anyone got any ideas? Thanks in advance!
  7. Hi guys, I've added this code into blockcart.tpl to add a button that prompts the customer to add an extra item to their order whenever a product is added to the cart. <div> <a class="btn btn-default button button-medium" href="https://www.ukvape.club/31-coils" title="Add coils" rel="nofollow"> <span>Add a pack of coils to my order</span> </a> </div> The result looks like this: Now I want some way to track which customers click the button, so I'm thinking of adding a variable in the cookie, something like $cookie->upsellClick = 1; That could be called in the "new order" email template. What I want to know is, how can I set this cookie variable when the button is clicked? I'm assuming there's going to be some javascript involved, and being a total stranger to js I wouldn't know where to start. If someone could point me in the right direction it would be a great help Thanks in advance, Stu
  8. Hi guys, I've started having some problems recently when trying to manually create an order for a customer via the back office. Everything's fine unless I try to use a cart rule (voucher) in the order. If I try to confirm an order that has a cart rule applied to it, I get a whitescreen. I enabled debugging and the error causing the whitescreen is: I've had a look at CartRule.php and here's the section containing line 1050... /** * Return the estimated cart VAT from the difference between the total amount taxes included and taxes excluded. * @return float Estimated VAT rate. */ public function getCartAverageVatRate() { $context = Context::getContext(); $cart_amount_ti = $context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS); $cart_amount_te = $context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); $cart_vat_amount = $cart_amount_ti - $cart_amount_te; if ($cart_vat_amount == 0 || $cart_amount_te == 0) $cart_average_vat_rate = 0; else $cart_average_vat_rate = Tools::ps_round($cart_vat_amount / $cart_amount_te, 3); return (float)$cart_average_vat_rate; } So, can anyone tell me what's going wrong here? I haven't changed anything to do with cart rules or Vat, so I'm at a loss. Thanks in advance! Stu
  9. Sorry for the shameless bump, can anyone offer any insights on this? Thanks!
  10. Hi guys, Recently I added some cart rules with no code, so that they are automatically applied when the criteria are met, for example, buy 4 of Item X (usually £3.99 each) to automatically apply a discount of £5.97 (final price £9.99) In most cases this is working without any problems, but a couple of times it has caused an error, the customer's transaction is processed by PayPal for the correct amount, but only half of the order (or no order) is shown in the Prestashop back office. Also, if I try to manually create an order through the back office, if it involves one of the "no code" cart rules, I get a white screen upon creating the order. Does anybody know what might be causing this and what I can do about it? Many thanks, Stu
  11. Rocky, your title of "PrestaShop Legend" is well deserved, works like a charm. Many thanks, Stu
  12. Hi guys! Ok, so basically what I'm trying to achieve is a module that will add a customer to a group called "MembersOnly" (ID: 5) when their first order is confirmed. This will grant access to a "Members Only" category page for existing customers. This is my first attempt at making a module, and basically I've been cutting, pasting and adapting code from elsewhere to meet the needs of the module. I think I'm right in assuming I've used the "actionValidateOrder" hook properly. At this point I think I just need to know the code that will add the customer to group ID 5. Here's what I've got so far... <?php if (!defined('_PS_VERSION_')) exit; class MembersOnly extends Module { public function __construct() { $this->name = 'membersonly'; $this->tab = 'front_office_features'; $this->version = '1.0.0'; $this->author = 'Ctrl-V'; $this->need_instance = 1; $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Members Only'); $this->description = $this->l('Add paying customers to new group'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MEMBERSONLY_NAME')) $this->warning = $this->l('No name provided'); } public function install() { if (!parent::install() OR !$this->registerHook('actionValidateOrder')) return false; return true; } public function uninstall() { if (!parent::uninstall()) return false; return true; } $context = Context::getContext(); $id_lang = $context->cart->id_lang; $customer = $context->customer; $id_customer = $customer->id; $groups = Db::getInstance()->executeS("SELECT " ._DB_PREFIX_. "customer_group.id_group , " ._DB_PREFIX_. "group_lang.name FROM " ._DB_PREFIX_. "customer_group LEFT JOIN " ._DB_PREFIX_. "group_lang ON " ._DB_PREFIX_. "group_lang.id_group = " ._DB_PREFIX_. "customer_group.id_group WHERE " ._DB_PREFIX_. "customer_group.id_customer = '$id_customer' AND " ._DB_PREFIX_. "group_lang.id_lang = '$id_lang'"); if(!isset($groups[0])) $groups = FALSE; } Now this should return the array $groups containing all groups that the current customer belongs to, I should be able to figure out how to query the array to check if group 5 is already present, I just need to know how to add group 5 if not. I'm assuming it's some kind of SQL wizardry. Hope someone can help me out, and thanks in advance
  13. After much frustration, and finally realising I was editing the wrong php file (there's a mailalert.php and a mailalerts.php, go figure) I've got this working. Many thanks again Fred, you're a star.
  14. Thanks Fred, that gives me something to work with! I'll let you know when I've wrapped by head around it
×
×
  • Create New...