Jump to content

HuffYk

Members
  • Content count

    29
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Vladimir
  1. HuffYk

    Who's Online Enhancement 1.4

    I upgraded my shop to 2.3.3.4 from 2.2 and this addon cannot load (it seems there is infinite loop). Any idea how to fix it before I start to debug it?
  2. you are welcome Dr.Rolex. Thank YOU for this contrib in 1st place :). Here is small fix for those who would like to use guest account. Problem is that delivery and billing addresses are not initialized in global $order variable and this makes modules which are linked only to specific zone not functional. here is fix for shipping part basically $order variable has to be initialized after $sendto is set (so delivery array in $order is correctly initialized). For guest account $sendto is using $order variable, thats why another "new order" is needed to initialize it correctly find this code in function _showShipping (file ajaxManagerTest.class.php) ajaxSessionUnregister("shipping"); $order = new order; if (GUEST_CHECKOUT == 'false' || ( GUEST_CHECKOUT == 'true' && ALLOW_CREATE_ACCOUNT == 'true' && $guest == false)) { // if no shipping destination address was selected, use the customers own address as default if (!ajaxSessionIsRegistered('sendto')) { $sendto = $customer_default_address_id; ajaxSessionRegister('sendto',$sendto); } else { // verify the selected shipping address $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $sendto = $customer_default_address_id; if (ajaxSessionIsRegistered('shipping')) ajaxSessionUnregister('shipping'); } } } elseif (GUEST_CHECKOUT == 'true') { // if no shipping destination address was selected, use the customers own address as default if (!ajaxSessionIsRegistered('sendto')) { $sendto = $order->customer; ajaxSessionRegister('sendto',$sendto); } } change to ajaxSessionUnregister("shipping"); if (GUEST_CHECKOUT == 'false' || ( GUEST_CHECKOUT == 'true' && ALLOW_CREATE_ACCOUNT == 'true' && $guest == false)) { // if no shipping destination address was selected, use the customers own address as default if (!ajaxSessionIsRegistered('sendto')) { $sendto = $customer_default_address_id; ajaxSessionRegister('sendto',$sendto); } else { // verify the selected shipping address $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $sendto = $customer_default_address_id; if (ajaxSessionIsRegistered('shipping')) ajaxSessionUnregister('shipping'); } } } elseif (GUEST_CHECKOUT == 'true') { // if no shipping destination address was selected, use the customers own address as default if (!ajaxSessionIsRegistered('sendto')) { if (!isset($order)) $order = new order; $sendto = $order->customer; ajaxSessionRegister('sendto',$sendto); } } $order = new order; here is fix for payment part similar fix is needed also for payment part. Here it is more tricky. There are payment modules which check not just billing address but also delivery. Thats why both variables has to be set ($sendto and $billto) find this code in function _showPayment (file ajaxManagerTest.class.php) ajaxSessionUnregister("payment"); if (GUEST_CHECKOUT == 'false' || ( GUEST_CHECKOUT == 'true' && ALLOW_CREATE_ACCOUNT == 'true' && $guest == false)) { // if no billing destination address was selected, use the customers own address as default if (!ajaxSessionIsRegIstered('billto')) { $billto = $customer_default_address_id; ajaxSessionRegister('billto',$billto); } else { // verify the selected billing address $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $billto = $customer_default_address_id; if (ajaxSessionIsRegistered('payment')) ajaxSessionUnregister('payment'); } } } elseif (GUEST_CHECKOUT == 'true') { // if no billing destination address was selected, use the customers own address as default if (!ajaxSessionIsRegistered('billto')) { $billto = $order->customer; ajaxSessionRegister('billto',$billto); } } $order = new order; change it to ajaxSessionUnregister("payment"); if (GUEST_CHECKOUT == 'false' || ( GUEST_CHECKOUT == 'true' && ALLOW_CREATE_ACCOUNT == 'true' && $guest == false)) { // if no billing destination address was selected, use the customers own address as default if (!ajaxSessionIsRegIstered('billto')) { $billto = $customer_default_address_id; ajaxSessionRegister('billto',$billto); } else { // verify the selected billing address $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $billto = $customer_default_address_id; if (ajaxSessionIsRegistered('payment')) ajaxSessionUnregister('payment'); } } // if no shipping destination address was selected, use the customers own address as default if (!ajaxSessionIsRegistered('sendto')) { $sendto = $customer_default_address_id; ajaxSessionRegister('sendto',$sendto); } else { // verify the selected shipping address $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $sendto = $customer_default_address_id; if (ajaxSessionIsRegistered('shipping')) ajaxSessionUnregister('shipping'); } } } elseif (GUEST_CHECKOUT == 'true') { if (!isset($order)) $order = new order; // if no billing destination address was selected, use the customers own address as default if (!ajaxSessionIsRegistered('billto')) { $billto = $order->customer; ajaxSessionRegister('billto',$billto); } // if no shipping destination address was selected, use the customers own address as default if (!ajaxSessionIsRegistered('sendto')) { $sendto = $order->customer; ajaxSessionRegister('sendto',$sendto); } } $order = new order; thats it.
  3. I think I found the answer for both questions. Order is defined in file ajax\ajaxManager.php. If somebody wants to switch login and create account here are steps I did: file: ajaxManagerTest.class.php function: showLogin change echo tep_draw_form('login', tep_href_link('ajax/ajaxManager.php', 'ajaxAction=PerformLogin&&target=payment_area', 'SSL'), 'post', 'id="login_form"', true); to echo tep_draw_form('login', tep_href_link('ajax/ajaxManager.php', 'ajaxAction=PerformLogin&&target=shipping_area', 'SSL'), 'post', 'id="login_form"', true); function: showCreateAccount change echo tep_draw_form('create_account', tep_href_link('ajax/ajaxManager.php', 'ajaxAction=PerformCreateAccount&&target=shipping_area', 'SSL'), 'post', 'id="create_account"', true) . tep_draw_checkbox_field('guest_account', true, false, 'style="display:none;" id="guest_account"'); to echo tep_draw_form('create_account', tep_href_link('ajax/ajaxManager.php', 'ajaxAction=PerformCreateAccount&&target=payment_area', 'SSL'), 'post', 'id="create_account"', true) . tep_draw_checkbox_field('guest_account', true, false, 'style="display:none;" id="guest_account"'); function: _showShipping change line if (!ajaxSessionIsRegistered('customer_id')) $this->showCreateAccount(''); to if (!tep_session_is_registered('customer_id')) $this->showLogin(''); function: _showPayment change line if (!tep_session_is_registered('customer_id')) $this->showLogin(''); to if (!ajaxSessionIsRegistered('customer_id')) $this->showCreateAccount(''); function: PerformLogin change echo '<divresult name="payment_area">'.$buffer.'</divresult>'; to echo '<divresult name="shipping_area">'.$buffer.'</divresult>'; change code $shipping_error = false; $shipping_buffer = $this->performAction2Buffer("showShipping", $get, $shipping_error); echo '<divresult name="shipping_area">'.$shipping_buffer.'</divresult>'; to $payment_error = false; $payment_buffer = $this->performAction2Buffer("showPayment", $get, $payment_error); echo '<divresult name="payment_area">'.$payment_buffer.'</divresult>'; function: _PerformLogin change $this->showPayment(''); to $this->showShipping(''); function: PerformCreateAccount change echo '<divresult name="shipping_area">'.$buffer.'</divresult>'; to echo '<divresult name="payment_area">'.$buffer.'</divresult>'; change $payment_error = false; $payment_buffer = $this->performAction2Buffer("showPayment", $get, $payment_error); echo '<divresult name="payment_area">'.$payment_buffer.'</divresult>'; to $shipping_error = false; $shipping_buffer = $this->performAction2Buffer("showShipping", $get, $shipping_error); echo '<divresult name="shipping_area">'.$shipping_buffer.'</divresult>'; function: _PerformCreateAccount change $this->showShipping(''); to $this->showPayment(''); file: ajaxManager.js function: ajaxPerformLogin change ajaxSendRequest(url,data,true,'payment_area', true, "POST"); to ajaxSendRequest(url,data,true,'shipping_area', true, "POST"); change ajaxSendRequest('ajaxAction=PerformLogin&email_address='+login_email_address+'&password='+login_password,ajaxUpdateContentMulti,true,'payment_area', false); to ajaxSendRequest('ajaxAction=PerformLogin&email_address='+login_email_address+'&password='+login_password,ajaxUpdateContentMulti,true,'shipping_area', false); function: ajaxPerformCreateAccount change ajaxSendRequest(url,data,true,'shipping_area', true, "POST"); ajaxSendRequest(url,data,true,'payment_area', true, "POST"); and change , ajaxUpdateContentMulti, true, 'shipping_area', false); to , ajaxUpdateContentMulti, true, 'payment_area', false); and thats it. Hope I have not forgotten something :). Everything seems to be working fine afterwards.
  4. Hi how exactly is controlled order of boxes? I understand code for boxes is in relevant functions in ajaxManagerTest.class.php as showPaymentInfo, showChangeAddress and all other show... functions, but where exactly is code which defines what is order of these function calls? I was not able to find it :). Also if I would like to have login box in shipping_area and create account in "payment_area" how to do it? :). I tried to change this in several places and without luck thanks
  5. Hi By setting defaults I meant setting default payment and shipping. I coded dependency between shipping and payment (each shipping method has list of allowed payment methods - it is currently hard coded but it works :) ). So I had to find out the way to control default values to not break dependency rules. I was able to fix php code, but problem was javascript defaults stored in variables selected_shipping and selected_payment. These were always zero and only clicking on radio button set them correctly. So when I for example didn't click any radio button and just clicked "update" button, always shipping and payment with index 0 was taken. Thanks to hidden img hack I was able set correct values also in javascript :) My next problem now is this: I have created shopping cart box in header and need to update its quantity and total price. This I was able to do just with changing IDs and classes of some objects. However one thing is still open - in header I have information text which is stating something like this "Buy more for 23 EUR and get another 6% discount". Of course I have to update this text when total in cart changes. So now I'm looking for place to fix this :) My guess is jquery-oscart.js from where I got also those IDs and classes :)
  6. OK I solved both problems. The 2nd one I solved with calling async false: function ajaxRefreshShipping(async) { ajaxSendRequest('ajaxAction=showShipping',ajaxUpdateContentMulti,true,'shipping_area', false); ajaxSendRequest('ajaxAction=showPayment',ajaxUpdateContentMulti,true,'payment_area', async); return false; }
  7. I was able to do defaults at last... I used hidden img tag with onload script which set all javascript variables correctly. Now I'm fighting with another problem. I built into this package dependency between shipping and payment modules. When shipping and payment modules are in edit mode, visibility is working fine (it means payment modules which should not be allowed for specific shipping module are now correctly disabled). However I need to fix "update" part - it means when shipping method is selected and also payment method is selected, I have to correct behavior after clicking on "update" buttons. It means when I click update on shipping module, also payment module has to go to edit mode because of possible dependency changes. And if clicking update on payment module, it has to show only dependant modules: 1. regarding update of payment modules, I might be able to fix it - I have already idea how to do it. 2. regarding update of shipping modules I have problem. I tried to change refreshshipping this way: function ajaxRefreshShipping(async) { ajaxSendRequest('ajaxAction=showShipping',ajaxUpdateContentMulti,true,'shipping_area', async); ajaxSendRequest('ajaxAction=showPayment',ajaxUpdateContentMulti,true,'payment_area', async); return false; } but it is not working. I was looking for solution but so far without luck:(. How can I enable for editing shipping and also payment areas?
  8. btw. the code is cleaner using JQuery but I still don't know how to set default :). $(document).ready(function(){ is called too soon. Is there something as ? $('body').on('ItemLoaded', 'itemLocatedAtTheBottomOfPage', function(event){
  9. Dr.Rolex: I tried your code and based on that I fixed mine. I will do some tests. Thank you!. I have just few questions: 1. I think this line is already obsolete in form_check.js.php, right? Object "selected" is nowhere used. if (selected) selected.className = 'moduleRow'; 2. I didn't change anything in ajaxManagerTest.class.php but I see your code is already using tables and not divs. So I have adapted form_check.js.php this way: $('body').on('click', '.moduleRow', function(event){ $(this).parent().find('div').removeClass('moduleRowSelected'); $(this).parent().find('input[type=radio]').attr('checked',false); $(this).addClass('moduleRowSelected'); $(this).find('input[type=radio]').prop('checked',true); .... 3. How exactly are you naming values of radio buttons? If you name one radio button shipping_0 and then you name another one payment_0, clicking on shipping_0 will affect also radio button in payment area (also payment_0 will be clicked, because of that "0" in name). This is because of form_check.js.php code. I thought about solution to have global $radio_buttons variable and just increase it through all radio buttons. At the end I change code in form_check.js.php. This is full click function: $('body').on('click', '.moduleRow', function(event){ $(this).parent().find('div').removeClass('moduleRowSelected'); $(this).parent().find('input[type=radio]').attr('checked',false); $(this).addClass('moduleRowSelected'); $(this).find('input[type=radio]').prop('checked',true); buttonselect = $(this).attr('value'); var selectable = $(this).find('input[type=radio]').prop('id'); // one button is not an array var shipping = document.getElementById('shipping'); if (shipping) { shipping.checked=true; } if (selectable.search("shipping_") == 0) { selected_shipping = buttonselect; } if (selectable.search("address_") == 0) { selected_address = buttonselect; } if (selectable.search("payment_") == 0) { selected_payment = buttonselect; } if (selectable.search("payment_address_") == 0) { selected_payment_address = buttonselect; } }); thanks
  10. I used very long time header_tags_controller. Now I'm converting my site to 2.3.3.4 from old 2.2. I checked header tags addons and see this one is using new system introduced in 2.3 - header tags modules. It is very easy to install and not to many changes into existing files. Thats why I like it more than controller. However what I miss from controller is "fill tags" functionality. Thats why I started to think about creating default meta tags in case seo fields are empty. For products it is actually done - I just started to use osc_get_mini_description. Same approach I did for categories and manufacturers (just copy&paste existing osc_get_mini_description and osc_split_mini_description and change fields and tables). One think why I write is I had to change all coalesce sql calls. Currently it takes empty string as valid value. I changed it to this: (use nullif functions for all seo fields): this way empty values are converted to NULL here is one example from osc_get_mini_description fnc $product_query = tep_db_query("select coalesce(nullif(products_mini_description,''), nullif(products_seo_description,''), LEFT(products_description, 300)) as products_precis from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "' and language_id = '" . (int)$languages_id . "'");
  11. I found another problem but I cannot find place to fix it :). Could you please help? Problem is with default selected shipping and payment methods. Even though default is selected correctly (it means DIV is created correctly with id="defaultSelected" class="moduleRowSelected" ) however when using "update" button (don't change radio selection, just click update), it uses variables from javascript: selected_payment and selected_shipping which are not set correctly and have default 0. These javascript values are set only after calling "selectRowEffect" funtion. I don't know how to call this function automatically after first start. I tried $(document).ready(function(){ but it seems this function is called before AJAX requests. So it doesn't work. I think update should be somehow called through AJAX but I don't know how?
  12. I have submitted new version of ajaxManagerTest.class.php to http://addons.oscommerce.com/info/8852 few corrections to ajaxManagerTest.class.php. Just replace original file. - fixed design of shipping box (it looks now same as payment box) - fixed handling of shipping zone (if shipping method had defined shipping zone, ajax_checkout was not working correctly)
  13. well actually I'm using code from Ajax Fast checkout 2.3.3 Rev2 from folder: catalog_for_jQuery_Shopping_Cart and I have just merged some changes from your last post of whole shop. I didn't know how to use drag and drop, but I saw your last post where changes into these files were done: bm_best_sellers.php bm_cycle_whats_new bm_order_history bm_reviews bm_specials bm_whats_new also_purchased_products new_products product_listing so basically in all files where products are shown were done changes to add class="draggable" and other attributes (rel, data-id, id). I was not aware how to use dragging (I never find guide for it, just found it in your sources). So after merging changes from your post I was able to use drag&drop from mentioned files. So drag and drop is now working fine. However in each of those file you had section about 30 lines long starting with " // Comment the code below if you don't use attributes". So it seems to be related for attributes and this is not working. I don't see anywhere attributes shown when doing dragging.
  14. btw. the code regarding drag&drop works great :) . I did already few tests. I see in the code it should somehow show also drop down with attributes. Any idea how to see it?
  15. yeah I thought about this also, maybe that would have been better option :). I installed quite a lot of addons in old system and did some customizations there therefore I decided to do it as I described. I was avoiding it many months but my server admin wants to do switch from PHP 5.3 to 5.4 so I was forced to do something with it :) Anyhow it took me maybe 1 week so it was not so bad. I used araxis merge tool - without it it would be much more painful. Thanks to araxis a lot of merges where done automatically. Afterwards I did once again compare with original 2.3.3.4 to understand differences The benefit now is I don't need to do many DB changes - just 2.3.3.4 relevant which I found on the web. After playing around with new 2.3.3.4 I like it became more modular. A lot of addons can be installed as modules. Knowing this before maybe I would have done it your way :)
×