Jump to content

Paul C

  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Paul C

  1. Ask and you shall receive: Display Prestashop Module Output Anywhere I should add that there are some caveats, and some modules (poorly written you might say) require other modules to be called before them etc. In general though that article should get you started, code incompatibilities aside. Paul
  2. I'm going to sound really boring here, but can I ask that when you post a problem with paypal payments can you specify in the post the version of Prestashop you're using AND the version/type of PayPal module you're using!! Nobody can really answer you without knowing.... Paul
  3. Sadly I only had time to write that code off the top of my head, not test it, so chances are I've made a logic error somewhere, especially if the order is never created (i.e. even with an error state). I'll try and have another go with it (with proper testing!) too and I'm sure between us we'll get something that will work! Paul
  4. Add module where I want.... Search is your friend :cheese: Paul
  5. You simply create a new directory under /themes and copy all the files from /themes/prestashop into it. Then you need to edit the tpl files in that directory adding/changing whatever parts of the xhtml and css you like -- HOWEVER -- the standard {$HOOK_XXX} tags that are included in the tpl files pretty much have to stay in the tpl files they are used in (you can movem arounf and encapsulate them in markup if you like though). To customise the homepage, for example, you need to edit /themes//index.tpl (which by default will just output everything rendered to the "Homepage content" hook position, which will be in the {$HOOK_HOME} template variable). For including the module output, you need to hook them into 'Homepage content' via Admin->Modules->Positions->Transplant a module HOWEVER some of the modules may not support being hooked there. If they do all support outputting content there, then it will work, and you can set the order they render in via Admin->Modules->Positions Good Luck, Paul
  6. Bottom line is that you need to restore the original files to remove it from the site. I think the chances are high that someone (maybe not you if this is the only site you work on that has the problem) has compromised their FTP account for that site and it's being used to upload the infection. The javascript just redirects I think (so as long as there's nothing nasty on the page you end up on it will be fine). You need to also make sure that the PCs used by anyone who has FTP access to that site don't have a virus that will compromise their FTP account again (you can possiby check access times against when the problem file was modified in your server logs). Change all of the FTP passwords. Note that if you're on shared hosting and any directory in your site has 777 permissions, then chances are high that ANYONE with an account/site on that shared server has the ability to infect files in those directories via FTP. Paul
  7. Gut feeling is the PayPal API module must need to enable/disable that option although I would have thought the default should be whatever is in your PayPal account preferences.... Haven't looked at the API module much but if you've still got the problem after I've had a chance to nosey I'll try and post a fix. Paul
  8. Quality stuff tomerg You've started my brain whirring, so i'll give you shout shortly with an idea for you :-) If i don't in the next few days PM me as it means I've forgotten lol Paul
  9. You might find using smarty in debug mode might help let you see what smary variables have been defined and what they contain: Debugging smarty in Prestashop. In particular if you turn the above on and enable FireBug, you be able to determine the state of all the variables as well as see what code is assign to the HOOK variable Good luck, Paul
  10. You could try: //global $cookie; // Hmm not sure about this one, it could be the killer $params = array(); $order = new Order(intval($id_order)); $currency = new Currency(intval($order->id_currency)); if (Validate::isLoadedObject($order)) { $params['total_to_pay'] = $order->total_paid; $params['currency'] = $currency->sign; $params['objOrder'] = $order; $params['currencyObj'] = $currency; // $params['cookie'] = $cookie; $params['cart'] = $id_cart; $smarty->assign(array( 'HOOK_ORDER_CONFIRMATION' => Module::hookExec('orderConfirmation', $params))); } I'm not saying it will work though, but I'm hopeful enough to suggest it. The above is in place of the $smarty->assign() call you were using above. The only sticking point might be the cookie..... Paul
  11. Looks fine to me? Either you've fixed it, or I'm not understanding the problem Paul
  12. I've only seen this once before and it had something to do with cookies getting messed up IIRC. I would try clearing everything and/or using a different machine/browser to eliminate that from the equation. Paul
  13. @billiam: did it work before but doesn't now? If so then check that your paypal account automatically accepts and converts payments made in other currencies, and also check that the payment isn't an eCheck or something. The standard PayPal module is very fussy. The other possibility is that your store just hasn't (but may have by now) received the IPN for that transaction from Paypal. I have a Paypal module available that can help diagnose such problems, but I hesitate to suggest it right now as I'm working on an improved version. Good luck! Paul
  14. Usually a module will hook to a default location in the install() member function of the module class. This is the "primary one". If a hook isn't supported (but it makes sense that it could be) then you can add an appropriate class member to the module class -- in effect all Prestashop does is maintain a list of modules per hook and it calls each one in turn to populate the $HOOK_XXX variable. Lets say a module (we'll call it 'widget') hooks into the header by default. Its class will have the following: class Widget extends Module { ... ... function install() { if (!$this->registerHook('header')) return false; return true; } ... ... function hookHeader($params) { ... ... return $data; } } In the install class member it's asking (registering) to be called every time $HOOK_HEADER is populated with data by the core. Note that the actual order that the modules add content is governed by the modules->position interface in the admin panel and is held in a mySQL table managed by that interface. We can't hook the above into the footer because when we do that we're telling the core to look for a member function called hookFooter() in the module class - which doesn't exist - so nothing happens and no content is added for display. If we modified the above to be: class Widget extends Module { ... ... function install() { if (!$this->registerHook('header')) return false; return true; } ... ... function hookHeader($params) { ... ... return $data; } function hookFooter($params) { return $this->hookHeader($params); } } Prestashop now has a function to call when we hook it into the footer position, and the module will render the same data there as it would have done in the header - so hopefully it all works. A problem potentially exists however where the output must be unique on the page and/or will conflict with something else -- sometimes this is the reason that modules DON'T hook to every possible position. You can only really try it and see. Hope that helps? Paul
  15. There's a few ways to do it. If you only have one domain (aren't parking other domains or transferring credit from previous domains to this one), then you can use the following (at the top) of your .htaccess file in the root of the domain: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^example\.com [NC] RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$ RewriteRule ^(.*)$ http%2://www.example.com/$1 [R=301,L] Obvously replace example.com with your own domain, and note that the \. is to escape any "dots" so .co.uk would be \.co\.uk but only need (and sometimes not) in the RewriteCond(ition) statement. This should likely work woth Prestashop friendly urls but I'm not in a position to test it right now! EDIT: the above also assumes that ssl is running on port 443 Paul
  16. Well if you don't want to populate it dynamically, then you can just insert the markup in to the various .tpl files. If you need/want to use images associated with products in your store, then you need a module in there somewhere to get the data, or (in some ways actually more difficult to do) you need to edit the core Prestashop files to insert code to provide the data to a template file. The fetaured products module has a template that can be overridden by placing a file of the same name (homefeatured.tpl) in your theme directory in a subdirectory named the same as the module i.e. in this case (because they have the same name) /themes//homefeatured/homefeatured.tpl All the data about featured products you will need is available to that template, so all you will have to do is modify the markup to display the product images and details in line with the description on that page. CSS and the jQuery javascript (not the library as it's already included) can be added directly into your template header.php file - right before the end of the head section. The products you wish to display in the slider must be assigned to the home category in the catalog section of the back-office for them to be displayed. Paul
  17. The $HOOK_XXXX variables are included by the Prestashop core at various fixed points that you cannot change unless you modify the core files. Modules provide functions that allow them to insert content into these variables though. You can "hook" a module's output into one of these variables from the back office using Modules->Positions->Transplant a module HOWEVER. A module needs to provide a hook function in its code in order for you to be able to transplant it there (IIRC it just fails silently). You can add hook functions in to existing modules though in an attempt to get them to hook into locations they weren't designed to (and it MIGHT work). You can look at the code for the various modules supplied to see which functions are used by each hook. Calling an existing hook function from your added one (as I did in the example above) may allow you to achieve the behaviour you require. If you're not experienced with PHP though, you may find it difficult! Paul
  18. During installation a settings file is created in the config directory (will have been public_html/xyz folder/config and now will be public_html/config) called settings.inc.php. I think you'll find that the following line is the one you need to change to the same as this: define('__PS_BASE_URI__', '/'); It will likely currently point to your subdirectory 'xyz folder'. Paul
  19. Disable modules one by one in the back office starting with the home text editor module and continuing through them in the order they appear in the positions list down the home hook and into the right column hook. It is important to do this in order and check the page after each is disabled. One of the modules has an error which is causing processing of the page to stop (which is why the right column and footer dissappear as they are rendered after the point that the error occurs. Good luck, Paul
  20. I've found that the reports on here: http://www.seo-theory.com/seo-white-papers/ Contain pretty good advice which can be used as a starting point. One thing I would advise against is trying to implement every single SEO "tip" or "trick" you come across on the web. Many were wrong to start with, are wrong now, or are based on getting you to pay for goods and/or services that you don't need or shouldn't use. You're off to a good start though, because you're testing and you're questioning. Paul
  21. fabien, yes that's theidea although i wanted to be able to keep the sideboxes the same across the site. You've done a good job of merging the two using the cms page as a lanch-pad though! Paul
  22. Ok. I think the easiest solution would be for you to modify the paypal payment module to take account of the slight differences in the payment received versus the payment expected. You could do this easily in the validation.php script within the PayPal module (when using the stardard, non-API version). Basically in that script you'll see the following: else $paypal->validateOrder($_POST['custom'], _PS_OS_PAYMENT_, floatval($_POST['mc_gross']), $paypal->displayName, $paypal->getL('transaction').$_POST['txn_id']); What we need to do is test the value of $_POST['mc_gross'] to check that it's within .01 of what we expect. If it is, then we use the amount we expect to get paid in place of it in the validateOrder function to trick Prestashop into thinking we did indeed receive the correct amount. so you could try replacing the above code (in /modules/paypal/validation.php) with: else { $cart = new Cart(intval($_POST['custom'])); $currency = new Currency(intval($cart->id_currency)); $expectedPayment = floatval(Tools::convertPrice(floatval(number_format($cart->getOrderTotal(true, 3), 2, '.', '')), $currency)); if (!paymentDiff($_POST['mc_gross'], $expectedPayment)) $paypal->validateOrder($_POST['custom'], _PS_OS_PAYMENT_, $expectedPayment, $paypal->displayName, $paypal->getL('transaction').$_POST['txn_id']); else $paypal->validateOrder($_POST['custom'], _PS_OS_PAYMENT_, floatval($_POST['mc_gross']), $paypal->displayName, $paypal->getL('transaction').$_POST['txn_id']); } function paymentDiff($paypalAmt, $expectAmt) { $diff = floatval($expectAmt - $paypalAmt); if ($diff<0) $diff = $diff * -1; if ($diff<0.02) return TRUE; else return FALSE; } Please note that I haven't tested the above, so make sure you keep a backup to easily get back to where you started :cheese: Paul
  23. The easiest way would be to make a slight modification to modules/blocknewsletter.php to add the code required to allow you to hook the module into the footer using the admin screens (modules->positions). You can also use the exclude functions to prevent it displaying on any page other than the home page. To add the hook you will need to add the following code to the end of blocknewsletter.php before the last '}' In 1.2.5 this will be after the externalNewsletter function. function hookFooter($params) { return $this->hookLeftColumn($params); } Paul
  24. Hmm. So are you saying that you think Prestashop is vulnerable, or are you saying that now your site has been hacked there are now 35 scripts that may be vulnerable to XSS? I'm not sure what you've actually tested here. Paul
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More