ultrandy Posted April 27, 2010 Share Posted April 27, 2010 I am going crazy!! ah!! I tried googling a solution to this, but people's websites with the actual same error I have is in their description clogging the results lol. The error message is: Warning: str_repeat() [function.str-repeat]: Second argument has to be greater than or equal to 0 in /home/oldblu5/public_html/catalog/includes/modules/payment/authorizenet_aim.php on line 182 I tried breaking it up a million different ways into google (obviously without my site name lol). The history on my site is I used the newest authorize.net module(the old one kinda worked AIM/SIM)but didn't connect properly and I was told to upgrade to this one instead!! Now I get this error message! I also used the most recent one page checkout... I disabled to the standard checkout for now. Here is what it looks like in my cart And in my authorizenet_aim.php file (the full function!) // Display Credit Card Information on the Checkout Confirmation Page function confirmation() { global $order; $confirmation = array('fields' => array( array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CREDIT_CARD_OWNER, 'field' => $_POST['authorizenet_aim_cc_owner']), array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CREDIT_CARD_TYPE, 'field' => $this->cc_card_type), array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CREDIT_CARD_NUMBER, 'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)), array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CREDIT_CARD_EXPIRES, 'field' => $this->cc_expiry_month . substr($this->cc_expiry_year, -2)))); if (MODULE_PAYMENT_AUTHORIZENET_AIM_USE_CVV == 'True') { $confirmation['fields'][] = array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CVV, 'field' => str_repeat('X', strlen($_POST['authorizenet_aim_cc_cvv']))); } return $confirmation; } LINE 182 above is 'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)), Thank you so much for your help? I'm just looking for a direction!! Please if you have any ideas I would be so grateful!!! THANK YOU!! :blush: :thumbsup: :rolleyes: >_< Link to comment Share on other sites More sharing options...
♥mdtaylorlrim Posted April 28, 2010 Share Posted April 28, 2010 This looks like an outdated Authorize.net module. Where did you get this module? Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...? Link to comment Share on other sites More sharing options...
ultrandy Posted April 28, 2010 Author Share Posted April 28, 2010 I tried many different ones, These are the ones I tested!! http://addons.oscommerce.com/info/4091 And this one! (Internally they are the same, and give the same error!) http://addons.oscommerce.com/info/6562 I even tried old editions of the module because I noticed the original AIM module doesn't seem to show that specific error! Really going to punch the wall pretty soon lol Link to comment Share on other sites More sharing options...
ultrandy Posted April 28, 2010 Author Share Posted April 28, 2010 If I take the original code from the original AIM module, the error goes away, however it doesn't work correctly. Should I just rewrite this? ORIGINAL (WORKING) $confirmation = array('fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('cc_number_nh-dns')), array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('cc_expires_year', $expires_year)), array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_CVC, 'field' => tep_draw_input_field('cc_cvc_nh-dns', '', 'size="5" maxlength="4"')))); return $confirmation; } NEW AIM METHOD(NOT WORKING) $confirmation = array('fields' => array( array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CREDIT_CARD_OWNER, 'field' => $_POST['authorizenet_aim_cc_owner']), array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CREDIT_CARD_TYPE, 'field' => $this->cc_card_type), array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CREDIT_CARD_NUMBER, 'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)), array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CREDIT_CARD_EXPIRES, 'field' => $this->cc_expiry_month . substr($this->cc_expiry_year, -2)))); if (MODULE_PAYMENT_AUTHORIZENET_AIM_USE_CVV == 'True') { $confirmation['fields'][] = array('title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CVV, 'field' => str_repeat('X', strlen($_POST['authorizenet_aim_cc_cvv']))); } return $confirmation; } Link to comment Share on other sites More sharing options...
♥mdtaylorlrim Posted April 28, 2010 Share Posted April 28, 2010 Of course it is not going to work... That line sends a credit card number to Authorize.net in the form "1234XXXXXXXX5678" It is actually sending the letter X in place of the credit card number. In order to get an approval you have to send a valid credit card number. On another note I would not use Authorize.net because it will require you to be fully PCI compliant. I would only use a module that sends the customer to the credit card companies site to enter the credit card details. The only thing you should need to change to gt this to work should be this line... 'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)), to this... 'field' => $this->cc_card_number, Of course, I may be wrong, but this would be my first step if I were to take the chance of using Authorize.net Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...? Link to comment Share on other sites More sharing options...
ultrandy Posted April 28, 2010 Author Share Posted April 28, 2010 In the past five hours I have tried so much thank you, now it doesn't display that error anymore...but it doesn't show fields to enter in information!! It seems though that there is something there lol, I highlighted it so that you can see what i'm talking about!! This happens for both modules btw. Thanks so much for your help, I really appreciate it! Link to comment Share on other sites More sharing options...
♥mdtaylorlrim Posted April 28, 2010 Share Posted April 28, 2010 In the past five hours I have tried so much thank you, now it doesn't display that error anymore...but it doesn't show fields to enter in information!! It seems though that there is something there lol, I highlighted it so that you can see what i'm talking about!! This happens for both modules btw. Thanks so much for your help, I really appreciate it! It shouldn't and you shouldn't use the 'Credit Card' module supplied with osC. It is for testing only and not for production use. Stick with the AIM module if you must. The credit card info will be input on the next page (I think.) Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...? Link to comment Share on other sites More sharing options...
ultrandy Posted April 28, 2010 Author Share Posted April 28, 2010 That is strange, I did not use the credit card module it came with. That one called credit card is the Direct Connect AIM authorize.net module I saw floating around. (I was curious lol) Link to comment Share on other sites More sharing options...
Guest Posted May 30, 2010 Share Posted May 30, 2010 Did you ever get this fixed? I have the same error. Link to comment Share on other sites More sharing options...
germ Posted May 31, 2010 Share Posted May 31, 2010 Did you ever get this fixed? I have the same error. Did YOU read the part about being PCI Compliant ( <= it's a link, click it to read more)??? If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.