Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by crunch

  1. Many thanks to the prestashop team for their efforts. That was the easiest and fastest fix for a compromised site I have ever done!
  2. You can also do a dump of all the object/variables in this script to see what is held within. This is useful if you need to know how the arrays/ojbects are structured to build your own functions on top. echo '<h1>ORDER id: '.$order_id.'</h1>'; echo '<pre>'; print_r($order); echo '</pre>'; echo '<h1>addressDelivery</h1>'; echo '<pre>'; print_r($addressDelivery); echo '</pre>'; echo '<h1>dlv_adr_fields</h1>'; echo '<pre>'; print_r($dlv_adr_fields); echo '</pre>'; echo '<h1>products</h1>'; echo '<pre>'; print_r($products); echo '</pre>'; echo '<h1>customer</h1>'; echo '<pre>'; print_r($customer); echo '</pre>'; echo '<h1>customizedDatas</h1>'; echo '<pre>'; print_r($customizedDatas); echo '</pre>'; echo '<h2>State: '.$state.'</h2>';
  3. gee, thanks for all the replies! I figured it out by digging into the order history page as it displays these details about an order. So most of the code could be found in the 'Order' class. I've adapted it into a small script below, that can grab orders details based on an array of order id's supplied. In my case, I was logging the details to a CSV file on a periodic basis, and then marking the orders are 'loggedToCSV' - which was a custom column I created in the orders table in the database. This way, each time the script is called, it only processed orders that had not previously been processed. This script grabs the necessary information, what you do with it is up to you. My script was quite specific - formatting it for entry into another system, so its not appropriate to have that here. Hence, I give you an adaptable script for use when working with orders. Hope its of use to someone! <?php /* note: you must change this to the path for your own config file */ require_once('/path/to/your/config/config.inc.php'); /* fetching the orders */ /* please note: additional db column 'loggedToCSV' in order table that has been created to log whether this order has been processed by this script or not You should adapt this to your own needs - it exists here to grab an array of order ids */ $orders = array(); // holds the ids of all orders we are concerned with $sql = "SELECT id_order FROM "._DB_PREFIX_."orders WHERE loggedToCSV = 0 AND valid = 1 ORDER BY id_order;"; $result = mysql_query($sql); if(mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $orders[] = $row['id_order']; } } foreach( $orders AS $order_id ){ /* get the order information */ /* ------------------------- */ $order = new Order($order_id); $id_order_state = (int)($order->getCurrentState()); $carrier = new Carrier((int)($order->id_carrier), (int)($order->id_lang)); $addressInvoice = new Address((int)($order->id_address_invoice)); $addressDelivery = new Address((int)($order->id_address_delivery)); $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country); $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country); $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields); $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields); $state = State::getNameById($addressDelivery->id_state); if ($order->total_discounts > 0) { $total_discounts = (float)($order->total_paid - $order->total_discounts)); } $products = $order->getProducts(); $customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart)); Product::addCustomizationPrice($products, $customizedDatas); $customer = new Customer($order->id_customer); /* handle each product line in the order */ /* ------------------------------------- */ foreach($products as $product) { // your code to process each product array } }
  4. When an order is made, is the actual price paid for each product recorded in the database anywhere in the order detail? I could not find this in PS 1.4.3. I have an external script which does something with orders - transfers a CSV list of recent ones to another site at regular intervals. (The script is external because I run it via cron - otherwise I guess I could just use a pre-existing module to export orders). Between 1.3.3 and 1.4.3 (just upgraded) there seems to be a difference in the way prices are recorded in the database for order details in regards to the price of the product and the actual price paid in the order. I can't see anywhere in the 'order_detail' database table the *actual* price paid for a particular product. In other words, it looks like some function still has to calculate this based on discounts and taxes etc. Maybe I'm wrong about that - I'd be happy to be wrong! For instance, in PS 1.4.3, i have an item for sale for $10, and have added a discount on this item of $11 ( which is the price + tax ie effectively making the item $0, free). The order detail still shows the item up as being $10. In my previous version of PS, the recorded price would be $0.00 ie the discounts are applied and it is the actual paid price. But this is where my problem is. How can I calculate the actual amount paid for each product in an order, via an external script that is querying the database? If I wrote a new script to do this, is there a logical process to follow in how I would gather these values? The output file I have to create (CSV) is quite specific. I'm looking for an overview of how to get the correct order details I'm looking for. Sorry if this question is not clear enough or I am asking for a complex answer - I'm trying to get to grips with the core in ways I have not had to previously. Thanks Using Prestashop 1.4.3
  5. 'referral code' was the name of the new text field I needed to be included in my site registration process. It's whatever you want.
  6. i found the solution, after installing firephp - a good debugging tool. After upgrading, the replacement config file 'defines.inc.php' had removed my custom payment definition line, used when adding an order and giving it an order state. eg /* Order States */ ... define('_PS_OS_CUSTOMPAY_', 12); Unfortunately, it didn't solve the problem that no invoices were created for the orders that had been paid for during this time when it was not working. I think I will have to live with that...unless you have a better idea!
  7. I would like to build on boran's instructions, just to be clear: extract FirePHPCore folder into the shop root. in config/config.inc.php, add: include_once(dirname(__FILE__) .'/../FirePHPCore/fb.php'); And on any line of a module (for example), create your debug statements like so: $firephp = FirePHP::getInstance(true); $firephp->log('just a message'); $firephp->log($some_var, 'some var name'); You need: - firefox - firebug extension - firephp extension - make sure NET and CONSOLE panels are turned on in firebug More information here
  8. ah great! i suspected this was the case, but i wanted to be sure!! Do you know how long the cart persists for? Is it forever, or until emptied?
  9. I had someone build a payment module which I set up ok for v1.2.5. Since upgrading to, it no longer works properly. The developer is no longer supporting it, so I'm looking for help to fix it - I don't it should be much to fix, but finding the problem is taking me time!! The actual payment goes through fine, but the orders do not show up in the back end. However, they are still locatable via the customer carts. The problem seems to be that the invoice number and invoice date are not passing through properly. If i look at the database table for ps_orders, i can see these columns are empty, whereas previously they had a number and date. Where do I get and pass these values across? Can anybody here give me a pointer?
  10. Just a question on how the cart functionality works.... When someone creates a cart, but doesn't order anything and leaves the site - then when they return their cart is still available with all the products they chose from the previous visit. So i have two questions: How long does this cart stay 'active' for? ie how long can they leave it and still come back to it Does an item being in a cart 'hold' one from the stock value? Im worried that if I only have 5 items, and 5 people put one in a cart without buying it, that it will leave zero items available if a genuine buyer comes along. Thanks
  11. This is more of a post for others reference in case the same happens to them. I have Prestashop 1.2.5 running, and tried to install the product comments module, which it reported installed ok, but when i try to make a comment on a product page and submit it - nothing happens. There were no comments to moderate in the module. After digging around for a while I discovered that the header hook had not registered in the database during module installation. I have no idea how that could happen, because the code looks correct to me. So all I did was to add a new row in the table 'ps_hook_module' table: id_module = look it up in ps_module table id_hook = 9 (for header) position = 1 And wahay, my product comments are now working. I didn't see any explanation anywhere, but you must go to the module configuration to approve/reject comments if you have validation turned on. Aslo you cant delete comments once approved without directly going to the database.
  12. Does anyone know when 1.3 is likely to move to beta / rc / final? Some of the pricing bugs are really frustrating for my client, so I want to be able to tell him when I should be able to safely upgrade. I don't want to use alpha or beta versions.. I'm just looking for an estimate - not any fixed dates or commitments from anyone!! thanks
  13. A company I'm building a site for has bases in Australia and New Zealand, and applies the respective forms of Taxes in both countries (its called GST in both - but its 10% in Aus and 12.5% in NZ). Looking at the wiki page that shows how taxes work it seems to me like its not possible to have a country tax active in more than one country at a time. If it is possible does anyone know how? I fudged it by making New Zealand contain states, and then adding 'New Zealand' as a state within New Zealand, which meant I could charge taxes on the 'is in a state' basis - as that disregards what country it is in. Australia also contains states, but its just one tax for all of them. It's not perfect but it works! But if someone knows a better way to do it --- let me know!
  14. Oh, and don't make the mistake I did of getting the securepay this module is for (www.securepay.com) mixed up with the other securepay (www.securepay.com.au)
  15. currently it doesn't work - I believe it was coded for a previous version of Prestashop, so it may only be a minor fix to get it to work with the current version. However, it might take some time for you to decode how prestashop modules and installation of them works, as there is no documentation.
  16. Ok - here is where I have got with this, which seems to be working ok.... Essentially, all I have done is check whether or not to show the link for the referral program in the 'my account' block, as this seems to be the only place you can access the module to enter email addresses. I've done this by assigning certain customers to a group - created in the Back Office - and then modifying the module files to check if a customer is in the special group or not. I only had to modify two files in the 'referralprogram' module, but unfortunately this did mean hacking a core php file for this module, as I believe you can only put modified .tpl files in your /themes//modules/ folder, and not .php files. my-account.tpl added the smarty if statement to wrap around the link to the referral program <!-- MODULE ReferralProgram --> {if $isInSpecialGroup} {l s='Referral program' mod='referralprogram'} {/if} <!-- END : MODULE ReferralProgram --> referralprogram.php modified the hook_customer_account method: public function hookCustomerAccount($params) { $customerID = $params['cookie']->id_customer; $referrals_allowed = $this->verifyInSpecialGroup($customerID); global $smarty; $smarty->assign(array( 'isInSpecialGroup' => $referrals_allowed )); return $this->display(__FILE__, 'my-account.tpl'); } ...and added a new method at the bottom of the file: private function verifyConsultantStatus($user){ $consuls = new Group(); $consuls->id = (2); // hard coded id of special group $consultants = $consuls->getCustomers(); $isInSpecialGroup = 0; foreach($consultants as $consultant){ if( $consultant['id_customer'] == $user ) { $isInSpecialGroup = 1; } } return $isInSpecialGroup; } Any comments welcome!
  17. great list for newcomers like me - thanks for posting!!!
  18. I would like to customise the 'Customer Referral Module' so only certain customers can access its features. My query is really to more experienced prestashop developers to see how easy they think this would be. For example. I have 100 customers, but only 10 of those I wish to allow to create 'referrals'. I could easily create a flag in the database to show whether someone should be able to refer or not - as far as the benefits go (eg 10% off) it doesnt matter - its just the ability to refer. Do you think this would be a relatively easy 'hack', or is it probably quite a bit of work because the module is not built that way? Really all I am looking for is an indication from someone who is familiar with prestashop development and the customer referral module - I have not yet had the time to pull the code to peices to see how prestashop works.... I wish there was some 'developer overview' to explain it! Thanks
  19. I will try to get the module working in 1.2.4 if possible. Does any kind of guide/faq exist that would help me understand the requirements of a module for this version? I am new to prestashop, but not new to php, but so far don't understand the process of how prestashop manages modules. Thanks
  20. when i unzipped it, it created a folder - named 'paysecurepay'. I didnt realise it had to be also named the same as the main php file inside i.e. 'payauthorizenet'. Once I did that i was able to install it.
  21. I've tried to install a payment module ( found here ) and when i click install in the back office modules page, i get the message 'hack attempt'. Can anyone give me a clue as to what could be possible causes of this, or a pointer to what i should maybe look at/check first? I'd really appreciate some help - I've set up my site and done all the customisation - this is the last step!! Edit: Im using v1.2.4
  22. I discovered the answer to my problem! Under Shipping > Countries, at the very bottom, I set my default country to be 'Australia' where the tax is applied. And this solved it!
  23. I am also having trouble with the taxes displaying. I'm using v1.2.4. If i use a customer account and log in, then the tax shows, as I have stated my address/country. But if i don't log in, then the tax incl. and tax excl. show as the same thing... which is misleading. I also am using Australian tax of GST 10%, and i've set it to be applicable to one of my zones which is called 'Rest of the World', as well as all Australian states, yet it still does not show... Most of the visitors to my site will be in Australia, but visitors who have not yet registered or logged in will not see the full price. I'd rather display the tax inclusive price than the tax exclusive one. How can I set the GST to be included by default for anonymous visitors? Perhaps this is just the way prestashop works? Or is there a way to make it display the tax by default when you visit the site?
  • Create New...

Important Information

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