15 replies [Last post]
ragazzo's picture
Offline
Joined: 01/17/2008
Juice: 27
Was this information Helpful?

Bug or feature: I have just "Enabled card type field on checkout form" (uc_credit_type_enabled) but the HTML-output seems a bit weird to me:

<div class="form-item">
<select id="edit-cc-type" class="form-select" name="cc_type">
<option value="&amp;lt;p&amp;gt;Visa Mastercard American Express&amp;lt;/p&amp;gt;">

&lt;p&gt;Visa Mastercard American Express&lt;/p&gt;

</option>
</select>
</div>

Besides I have only chosen 2 credit cards to be processed.(Visa and Mastercard, Amex should not be in the pulldown)

Lots of questions...

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Credit Card: card - type - select - field on checkout form

Thanks for bringing that up... I don't use it on the Livetest, so it very well may be a bug. In the meantime, if you look at the CC settings you'll see a textarea that lists credit card types. The settings are a little confusing in that the checkboxes are just for icons while the textarea is for that select box. Try adjusting the values there to remove the others. I'll look into the bug on Monday!

ragazzo's picture
Offline
Joined: 01/17/2008
Juice: 27
Re: Re: Credit Card: card - type - select - field on checkout f

@Jodo: thank you for your information! The coding system will be very useful for shops that offer the whole range of (all four major) credit cards. As we are going to limit the choice to only two cards I will want to visualize the limitation by a pulldown containing only the accepted credit card types.

@Ryan,
putting the card-types into separate lines in the text area improves the situation dramatically. There remains only one thing to be solved: the <p>...</p>-Tags on the beginning and end of each option-line:

<option value="&amp;lt;p&amp;gt;Mastercardxxx&amp;lt;/p&amp;gt;">
&lt;p&gt;Mastercard&lt;/p&gt;
</option>
<option value="&amp;lt;p&amp;gt;Visa&amp;lt;/p&amp;gt;">
&lt;p&gt;Visa&lt;/p&gt;
</option>

Unfortunately I was not able to find the code implementing the variable_set for

uc_credit_accepted_types 
==========================
s:33:"<p>Mastercardxxx</p>
<p>Visa</p>";

where the annoying p-tags are stored.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Credit Card: card - type - select - field on checko

I tested this on the Livetest and could not duplicate the p tags... so let me take a shot in the dark and ask if you're using a module to add WYSIWYG capabilities to textareas... if so, then you need to disable it on that textarea and enter the card types in plaintext. That's a likely cause of the problem... others had this difficulty with the EDI contrib.

digitalfrontiersmedia's picture
Offline
Getting busy with the Ubercode.
Joined: 11/08/2008
Juice: 282
Purpose of card-type select?

What exactly is the purpose of the card-type select? It appears it isn't necessary to complete a transaction (at least not with Authorize.net) since if the select field is not enabled, the transactions can still go through. And while I might not be looking in the right place, I can't find anywhere in the database where it is saving the card-type.

My dilemma: My client needs to know by looking at the orders what type of card was used (have no idea why). It seems odd that the user specifically enters that information through a select yet it doesn't appear to be used or stored. Is there anyway to access this from the /orders or /payments screens that I don't know about? If not, have suggestions on what would probably be the easiest way to implement this?

Thank you,
Stephen

digitalfrontiersmedia's picture
Offline
Getting busy with the Ubercode.
Joined: 11/08/2008
Juice: 282
Where is CC type stored?

Okay, I know the CC type is being stored somewhere because if you go to edit an order, the payment pane shows the credit card information including the credit card type (Visa, AMEX, etc.).

But where is it in the database?

If I know where it is, I could perhaps add something into the /orders View that displays the CC type on that page as well.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Where is CC type stored?

Should just be in $order->paymet_details ... not including it on the order view page is a bit of an oversight.

digitalfrontiersmedia's picture
Offline
Getting busy with the Ubercode.
Joined: 11/08/2008
Juice: 282
Re: Re: Where is CC type stored?

Fantastic! Thank you!

Stephen

digitalfrontiersmedia's picture
Offline
Getting busy with the Ubercode.
Joined: 11/08/2008
Juice: 282
Re: Re: Where is CC type stored?

No oversight--Card Type should be printed in View Order. "Card number" prints out for me, but "Card type" does not. Yet, the code is there for it (starting around line 491, uc_credit.module):

    case 'order-view':
      // Add the hidden span for the CC details if possible.
      if (user_access('view cc details')) {
        uc_add_js(drupal_get_path('module', 'uc_credit') .'/uc_credit.js');

        $output .= '<span onclick="toggle_card_details();" style="cursor: pointer;">'
                  .'<a id="cc_details_title" href="" onclick="return false;" style="display: none;">'. t('View card details.') .'</a>';

        $output .= '<span id="cc_details"><table style="width: auto;">';


        if (variable_get('uc_credit_type_enabled', TRUE)) {
          $type = check_plain($arg1->payment_details['cc_type']);
          if (strlen($type) > 0) {
            $output .= '<tr><td>'. t('Card Type:') .' </td><td>'. $type .'</td></tr>';
          }
        }


        if (variable_get('uc_credit_owner_enabled', FALSE)) {
          $owner = check_plain($arg1->payment_details['cc_owner']);
          if (strlen($owner) > 0) {
            $output .= '<tr><td>'. t('Card Owner:') .' </td><td>'. $owner .'</td></tr>';
          }
        }

        $output .= '<tr><td>'. t('Card Number:') .' </td><td>'. uc_credit_display_number($arg1->payment_details['cc_number']) .'</td></tr>';

I would assume then if no one else is having problems with "Card Type" that this is a problem with my installation somehow? Not saving the Card Type (strlen = 0)?

EDIT: should this be it's own "bug report"?

EDIT: Just went in and tried to edit an order, changing it's card type field to "American Express". Hit submit, viewed order again, and it reverted back to "Visa". Is this a bug where it's not saving the card type upon submit? Which module should it be reported under? uc_credit, uc_payment?

digitalfrontiersmedia's picture
Offline
Getting busy with the Ubercode.
Joined: 11/08/2008
Juice: 282
Re: Re: Re: Where is CC type stored?

Is "Card Type" not stored due to PCI guidelines?

This section of code from uc_credit.module (lines 264-283) seems to indicate so:

      case 'save':
      if ($arg1->payment_method == 'credit') {
        // Build an array of CC data to store with the order.
        if (!empty($arg1->payment_details)) {
          // Check for debug mode.
          if (variable_get('uc_credit_debug', FALSE) && arg(1) != 'checkout') {
            // If enabled, store the full payment details.
            $cc_data = $arg1->payment_details;
          }
          else {
            // Otherwise, save only some limited, PCI compliant data.
            $cc_data = array(
              'cc_number' => substr($arg1->payment_details['cc_number'], -4),
            );
          }

          _save_cc_data_to_order($cc_data, $arg1->order_id);
        }
      }
      break;

jodo's picture
Offline
Joined: 01/10/2008
Juice: 28
OT Question

Why ask for the customer to check off which cc they are using when the type of card it is is contained in the number itself? 3=amex, 4=visa etc

ragazzo's picture
Offline
Joined: 01/17/2008
Juice: 27
Re: OT Question

Jodo, I supposed there ought to be an identification-code-system somehow. Where can I get further information on that?

jodo's picture
Offline
Joined: 01/10/2008
Juice: 28
reply

Ragazzo, the four major cards each start with a unique number:

Amex 3xxx
Visa 4xxx
MC 5xxx
Disc 6xxx
Don't really know about any of the others but I would assume they follow the convention.

phpsharma's picture
Offline
Joined: 04/21/2010
Juice: 4
<p> tags issue is due to rich text editor

I got the same problem and solved it by editing the content of the card type text area by plain text editor..

if you use rich text editor this problem persists.

paullu618's picture
Offline
Joined: 04/26/2010
Juice: 3
Re: <p> tags issue is due to rich text editor

How did you solve the problem? ? I use FCKeditor, and I tried adding the cart/checkout to the excluded list and even disable the FCKeditor module, but the problem still occur.
Please help
Thanks

Infinitee's picture
Offline
Joined: 02/19/2010
Juice: 78
Exactly how did you remove the paragraph tags?

I have the FCK editor installed but set not to render on cart* pages so, I don't have the option to switch to the plain text editor in the Payment method options.

Thanks,

Ralph

PS Please point that thing in another direction!

Ralph Manis
Infinitee Web Design
http://www.infiniteewebdesign.com