Full service web hosting, great prices and support. Starts at $1.99/month!
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

  1. #1
    New Member
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    sio     $ 0.00
    Rep Power
    0


    Default Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Hello everybody,
    I want to change the payment module COD (wich I do not need) into a "Pay when receiving invoice" (wich does not exist).

    Since the shop offers virtual and non virtual products the payment module "Pay when reveiving invoice" shall only be available, if the cart does not carry any virtual product.

    My question: How can I change the line in /includes/modules/payment/coc.php in a way that it applies not only for content=virtual but also for content contains virtual amongst others?

    I tried to replace

    if ($this->enabled == true) {
    if ($order->content_type == 'virtual') {
    $this->enabled = false;
    with <= or >= but without success.
    Any ideas?

    Thanks

    Ruben

  2. #2
    osCMax Development Team

    Payment type COD to be changed to be disabled if virtual product  is in cart - amongst  others!

    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,517
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    pgmarshall     $ 35.00
    Rep Power
    81


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Ruben,

    Try using the get_content_type() function.

    Code:
    if ($cart->get_content_type() != 'virtual') {
    Also you need to use == or != for equals or not equal to in PHP.

    The possible returns from this function are virtual, mixed, physical - So I think in your example you will need something like:


    Code:
    if ($cart->get_content_type() != 'physical') {
    $this->enabled=false;
    }
    Because you want to hide the module if it is virtual OR mixed ie. != (NOT EQUAL) to physical.

    Regards,
    pgmarshall
    _______________________________

  3. #3
    New Member
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    sio     $ 0.00
    Rep Power
    0


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Thank you Pgmarshall,

    I tried it with

    if ($this->enabled == true) {
    if ($cart->get_content_type() != 'virtual') {
    if ($cart->get_content_type() != 'physical') {
    $this->enabled=false;
    }

    Is it how you meant it? Checkout payment - screen will be blanc then.

    Then I tried to replace virtual with mixed and got some strange result:
    When first product in cart was virtual COD was not enabled, no matter what kind of further product I added.
    When first product was physicall COD was enabled no matter what kind of product I added.
    if ($this->enabled == true) {
    if ($order->content_type == 'mixed') {
    $this->enabled = false;

    So it is a step forward but still not working.

    Are there any further ideas how to solve this problem?

    Thank you and best regards,

    Ruben

  4. #4
    osCMax Development Team

    Payment type COD to be changed to be disabled if virtual product  is in cart - amongst  others!

    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,517
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    pgmarshall     $ 35.00
    Rep Power
    81


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Nope!

    Just put:

    Code:
    if ($cart->get_content_type() != 'physical') {
    $this->enabled=false;
    }
    Regards,
    pgmarshall
    _______________________________

  5. #5
    New Member
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    sio     $ 0.00
    Rep Power
    0


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Sorry pgmarshall,

    I can't get it working. If I put


    Code:
    if ($cart->get_content_type() != 'physical') {
    $this->enabled=false;
    }
    I just get a blank screen for checkout payment.

    Do I need to make changes at some other place too?

    Thank you and best regards
    Ruben

  6. #6
    osCMax Development Team

    Payment type COD to be changed to be disabled if virtual product  is in cart - amongst  others!

    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,517
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    pgmarshall     $ 35.00
    Rep Power
    81


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Is the only change you made to the module?

    White screen = PHP error ... turn on error reporting and post the error back here. (instructions in the wiki).

    Regards
    pgmarshall
    _______________________________

  7. #7
    New Member
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    sio     $ 0.00
    Rep Power
    0


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Quote Originally Posted by pgmarshall View Post
    Is the only change you made to the module?

    White screen = PHP error ... turn on error reporting and post the error back here. (instructions in the wiki).
    I didn't change anything else as far as I know.

    White screen = PHP error ... turn on error reporting and post the error back here. (instructions in the wiki).

    It says:

    Warning: Division by zero in /public_html/shop/includes/classes/shipping.php on line 104

    Warning: Division by zero in /public_html/shop/includes/classes/shipping.php on line 105

    Warning: Cannot modify header information - headers already sent by (output started at /home/u0030664681/public_html/shop/includes/classes/shipping.php:104) in /public_html/shop/includes/functions/general.php on line 34
    In /public_html/shop/includes/classes/shipping.php it says on lines 103-105:

    if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes
    $shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);
    $shipping_weight = $shipping_weight/$shipping_num_boxes;
    In /public_html/shop/includes/functions/general.php on line 34 I find

    header('Location: ' . $url);
    Best,

    Ruben

  8. #8
    osCMax Development Team

    Payment type COD to be changed to be disabled if virtual product  is in cart - amongst  others!

    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,517
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    pgmarshall     $ 35.00
    Rep Power
    81


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Do you have a value in Admin -> Configuration -> Shipping/Packing -> Enter the Maximum Package Weight you will ship?
    pgmarshall
    _______________________________

  9. #9
    New Member
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    sio     $ 0.00
    Rep Power
    0


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Quote Originally Posted by pgmarshall View Post
    Do you have a value in Admin -> Configuration -> Shipping/Packing -> Enter the Maximum Package Weight you will ship?
    Thank you pgmarshall, I did not have a value in there and did not know that it was needed. Now I've entered 1000 and get the following error:

    Fatal error: Call to a member function get_content_type() on a non-object in /public_html/shop/includes/modules/payment/cod.php on line 58
    Line 57-59 contain your suggestion:
    if ($this->enabled == true) {
    if ($cart->get_content_type() != 'physical') {
    $this->enabled=false;
    }
    }
    Ruben

  10. #10
    New Member
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    sio     $ 0.00
    Rep Power
    0


    Default Re: Payment type COD to be changed to be disabled if virtual product is in cart - amongst others!

    Quote Originally Posted by sio View Post
    Thank you pgmarshall, I did not have a value in there and did not know that it was needed. Now I've entered 1000 and get the following error:



    Line 57-59 contain your suggestion:


    Ruben
    hello pgmarshall,
    do you have any further idea about that issue?
    thank you for taking the time!

    best
    ruben

Page 1 of 2 12 LastLast

Similar Threads

  1. Can New Product Duration Be Changed?
    By m82492 in forum osCmax v1.7 Discussion
    Replies: 6
    Last Post: 06-05-2009, 12:30 AM
  2. Virtual Merchant - Elavon, ViaKlix, Nova Payment Module
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 01-21-2009, 06:10 PM
  3. Virtual Merchant - Elavon, ViaKlix, Nova Payment Module
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 01-07-2009, 06:12 PM
  4. Virtual Merchant - Elavon, ViaKlix, Nova Payment Module
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 12-15-2008, 01:00 PM
  5. Products default to content type virtual or 'downloadable'
    By cameroti in forum osCmax v2 Installation issues
    Replies: 2
    Last Post: 10-20-2005, 02:01 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •