History of Uses not working


  • Your avatar
    seyi    
     6 years ago
    0

    And some of the reports....

    Getting 2 warnings


    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/ecomarke/public_html/libraries/joomla/database/database/mysql.php on line 344

    and

    Warning: Invalid argument supplied for foreach() in /home/ecomarke/public_html/administrator/components/com_awocoupon/views/usershistory/tmpl/default.php on line 54

    The latter would suggest that the db pointer is null.

    This is after creating and using 2 coupons. These are generic coupons percentage discount with limited usage.

    eg
    2 JBC003-C02 Published Coupon Product Percent Overall 10.00 Total 10

    Would seem that the #_awocoupon_user_uses is not being populated correctly

    JB

  • Your avatar
    seyi    
     6 years ago
    0

    Without seeing your installation this will be hard to debug but we can try.

    First thing is first, go to admin->components->awocoupon->"installation check". Verify that all codes are properly installed. If not get those fixed first and try again. The documentation gives instructions on how to install it manually if it cannot be automatically installed.

    Another thing you can look at. Read the data in #_awocoupon_user_uses table in the database. Is the order_number being populated?

  • Default avatar
    john59    
     6 years ago
    0

    Everything is OK. Have checked the User_uses file and Order number is being populated...

    Going to do a local install to see if I can figure out where the object is being passed from.

    System info

    PHP Built on: Linux reading.eukhosting.net 2.6.31.9-grsec-VISION #1 SMP Sun Apr 4 17:27:46 BST 2010 i686
    Database Version: 5.0.90-community
    Database Collation: utf8_general_ci
    PHP Version: 5.2.13
    Web Server: Apache
    Web Server to PHP interface: cgi
    Joomla! Version: Joomla! 1.5.17 Stable [ Wojmamni ama woobusani ] 27-April-2010 04:00 GMT
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729; .NET4.0C)

  • Your avatar
    seyi    
     6 years ago
    0

    Ok, the system info looks fine. Do you require users to log in before purchasing? And if not, did you make the purchases without logging in?
  • Default avatar
    john59    
     6 years ago
    0

    And I was logged in....

    My local installation of joomla and virtuemart works fine although version 1.5.15 (not 1.5.17).

    My PHP is too basic to figure out the relationships between the various code blocks so I cant work out what is being passed to the file C:\xampp\xampp\htdocs\joomla15\administrator\components\com_awocoupon\views\usershistory\tmpl\default.php

    to cause this to fail - foreach ($this->row as $i=>$row) :

    and this is failing in the database procrssor mysql.php

    function getNumRows( $cur=null )
    {
    return mysql_num_rows( $cur ? $cur : $this->_cursor );
    }

    So it looks as if the its a null pointer... but I dont know how it hangs together so cant debug it.

    JB
  • Your avatar
    seyi    
     6 years ago
    0

    the sql statement that populates the foreach can be found in
    www/administrator/components/com_awocoupon/models/usershistory.php, line 98 ish.

    Since this works in your dev environment you will need to do this in prod.

    After the sql statement that starts on line, type the statement "echo $sql;". Then go to your History of Uses tab and you should see the sql statement at the top. Now copy it, replace "#_" with your prefix (likely jos) and run it against the db in your prod environment. Something should error out and you should get feedback of what is wrong.

    if you would like me to look at it then feel free to send me some credentials privately.
  • Default avatar
    john59    
     6 years ago
    0

    getting the following error

    #1267 - Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='

    Its seems the AwoCoupon table have a collation of utf8_unicode_ci where as the rest of the tables have utf8_general_ci

    Have googled it and its seems that this is the problem. Also my local install are all utf8_general and this works.

    Going to see if I can adjust the tables directly.

    Success...

    Thanks alot
  • Your avatar
    seyi    
     6 years ago
    0

    Weird. Im not doing anything special for the table code. It should install the server defaults. In anycase, Im glad you got it figured out.
  • Default avatar
    chetanmadaan    
     4 years ago
    0

    Seyi -

    i am having the same issue... but this is not working for me.

    We are on Joomla 1.5.24 and the following query.
    "SELECT c.id,c.coupon_code,c.num_of_uses,c.coupon_value_type,c.coupon_value, c.min_value,c.discount_type,c.function_type,c.startdate,c.expiration,c.published, uu.coupon_id,uu.coupon_entered_id,c2.coupon_code as coupon_entered_code, uu.id as use_id,uv.user_id,uv.first_name,uv.last_name,uu.user_id,u.username, (uu.coupon_discount+uu.shipping_discount) AS discount,uu.order_number,uu.productids,uu.timestamp,ov.order_id,ov.cdate FROM jos_awocoupon_user_uses uu JOIN jos_awocoupon c ON c.id=uu.coupon_id LEFT JOIN jos_awocoupon c2 ON c2.id=uu.coupon_entered_id JOIN jos_vm_user_info uv ON uv.user_id=uu.user_id AND uv.address_type="BT" LEFT JOIN jos_users u ON u.id=uu.user_id LEFT JOIN jos_vm_orders ov ON ov.order_number=uu.order_number ORDER BY c.coupon_code LIMIT 0, 20"

    I changed all the tables collations to "utf8_general_ci" to match the Joomla core tables... but, this is not working for me.

    please help! the error i am getting in the PHPmyadmin window is:

    "#1267 - Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='"
  • Your avatar
    seyi    
     4 years ago
    0

    Hello,

    Its not the table collation you should be looking at, it is the specific column collation. Try these 2 columns:
    jos_awocoupon_user_uses->order_number
    jos_vm_orders->order_number

    Are the collations the same?
  • Default avatar
    chetanmadaan    
     4 years ago
    0

    Thanks for your fast reply... i already fixed it by running a query on these two tables.


    ALTER TABLE jos_awocoupon CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci';
    ALTER TABLE jos_awocoupon_user_uses CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci';
  • Your avatar
    seyi    
     4 years ago
    0

    great, glad you got it working