Jump to content
Latest News: (loading..)

Recommended Posts

I've seen this happen on a few sites. The defined name wouldn't work but a hard-coded one would. The problem seems to be host-related but I don't know why. You could try printing out the defined value to see if it is being picked up from the database OK. That might help find the problem.

 

Jack

Share this post


Link to post
Share on other sites

I'm not sure this is a host problem.

 

I've narrowed down it a bit though: The problem occurs with double firstnames written with Space between them (for example John Michael Anderson) and double lastnames written with Space, Dash, Space between them (for example John Lewis - Anderson).

 

Though I can't see why this should be a problem for Blacklist. :(

 

/MagWiz

Share this post


Link to post
Share on other sites

Here is the problem again.

 

Sorry for not being clear enough!

 

Basically I mean "putting them on the blacklist", i.e. I select a customer with a long name and push the button to add but nothing happens. (If I select a customer with a shorter name it works fine. )

 

Like I wrote in my previous post the problem seems to have something to do with double names.

 

Tanks again!

 

/MagWiz

Share this post


Link to post
Share on other sites

The code builds the names by breaking the name apart based on spaces. It only accounts for three names at this point.

 

Jack

Share this post


Link to post
Share on other sites

I'm trying to add a note/cross sign beside the customer name in the order list at admin/orders.php on those customers that are listed in the blacklist.

 

Can anyone tell me how to do this, I havent managed to fix this?

It would be a real great addon to this contribution.

 

// Fredrik

Share this post


Link to post
Share on other sites

Hmm, that is a good idea. You would need to add a new column to the customer display list and show the mark there. It is not something that can be easily explained here. For a quick change you could try finding this code in admin/customers.php

<td class="dataTableContent"><?php echo $customers['customers_firstname']; ?></td>

to

<td class="dataTableContent"><?php echo $customers['customers_firstname'] . ' X'; ?></td>

I'm not sure what that would do to searches or some other function but it might work.

 

Jack

Share this post


Link to post
Share on other sites

I will try to explain more in detail of what I have in mind.

If you have add an existing customer into the blacklist (admin/blacklist.php) and then he orders again, perhaps by open another accout or if you use Fast and easy checkout. Then the new order he made will be listed in admin/orders.php

Then It would be nice to add a warning on the line for this order. Take a brief look at Warn Cusgtomer Not Verified and you should understand what I have in mind.

 

What I acctually want to do is to merge these two contribs together. Instead of warning by order status, as it is in Warn Cusgtomer Not Verified, I want to give a warning if the customers info is in the database table that is used in your Blacklist cotrib.

 

any idea?

 

// Fredrik

Share this post


Link to post
Share on other sites

I'm not familiar with that contribution so I can't offer any help there. Marking the order can be done in a similar fashion to what I alerady mentioned though.

 

Jack

Share this post


Link to post
Share on other sites

I'm not sure if understand your previous post Jack.

 

If you do it like you said:

<td class="dataTableContent"><?php echo $customers['customers_firstname'] . ' X'; ?></td>

Then all orders will have an X by thier name. What I have in mind was to only have an X for those customers that match another customer with the simulair information in the blacklist table.

 

This is one of the codes that I tried to use in admin/orders.php to acomplish this

<?php

//check for blacklisted address
  $verify_query_raw = "SELECT b.customers_id, b.ban_customer, b.description, b.entry_street_address, b.entry_suburb, b.entry_postcode, b.entry_city, b.entry_state FROM " . TABLE_BLACKLIST . " b ";
  $verify_query = tep_db_query($verify_query_raw);
  $verify_result = mysql_fetch_row($verify_query);
  if ($blacklisted['entry_street_address'] === $order->delivery['street_address'] && 
	 $blacklisted['entry_suburb']		 === $order->delivery['suburb'] && 
	 $blacklisted['entry_city']		   === $order->delivery['city'] && 
	 $blacklisted['entry_postcode']	   === $order->delivery['postcode'] && 
	 $blacklisted['entry_state']		  === $order->delivery['state']) 

  {
	  $cust_warning = '<img src="images/icons/cross.gif" width="16" height="16" border="0" title="'.WARNING_CUSTOMER_NOT_VERIFIED.'">';
  } 
  else
  {
	  $cust_warning = '';
  }

?>

 

and then whhere the orders are listed

<td class="dataTableContent" align="right"><?php echo $orders['orders_status_name'] . ' '.$cust_warning; ?>

 

Unfortunately I havent got any luck with it. Either all orders are marked with cross.gif, or non of the order are marked. Even thou I have blacklisted a customer in blacklist.php

 

Do you know how to solve this?

 

Btw, thank you for your promt replays and your contribs :thumbsup:

 

// Fredrik

Share this post


Link to post
Share on other sites

You would need to read in the blacklist table and find which customers are blacklisted. Then add the mark for only those customers.

 

Jack

Share this post


Link to post
Share on other sites

Ok, I think I solved it with this code

 <td class="dataTableContent" align="right"><?php echo $orders['orders_status_name'];

//check for blacklisted address
 $blacklist_query = tep_db_query("SELECT b.customers_id, b.ban_customer, b.description, b.entry_street_address, b.entry_suburb, b.entry_postcode, b.entry_city, b.entry_state FROM " . TABLE_BLACKLIST . " b ");
 while($blacklisted = tep_db_fetch_array($blacklist_query))
 {	  
 if ($blacklisted['entry_street_address'] == $orders['customers_street_address'] or 
	 $blacklisted['entry_city']		   == $order['customers_city'] or 
	 $blacklisted['entry_postcode']	   == $order['customers_postcode']) 


 { 
?>
	 <img src="images/icons/cross.gif" width="16" height="16" border="0" title="Blacklisted">
<?php
 }	 
 }
?>
</td>

 

I have another question as well, does anyone happen to have the code to pull the customer information in blacklist.php from ORDERS_TABLE instead from the CUSTOMERS_ADDRESS_TABLE?

 

// fREDRIK

Share this post


Link to post
Share on other sites

I'm trying to insert the blacklist-information fron the orders table, instead from address book table.

I have changed

$address_book_query = tep_db_query("SELECT customers_id, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_country_id, entry_zone_id FROM " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $cust['customers_id'] . "'");

to

$address_book_query = tep_db_query("SELECT orders_id, customers_street_address, customers_suburb, customers_postcode, customers_city, customers_state FROM " . TABLE_ORDERS . " where orders_id = '" . $cust['customers_id'] . "'");

and I have changed

tep_db_query("insert into " . TABLE_BLACKLIST . " (customers_id, ban_customer, description, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, date_added) values ('" . $cust['customers_id'] . "', '" . $ban . "', '" . $reason . "', '" . $address['entry_street_address'] . "', '" . $address['entry_suburb'] . "', '" . $address['entry_postcode'] . "', '" . $address['entry_city'] . "', '" . $address['entry_state'] . "', now() )") or die('');

to

tep_db_query("insert into " . TABLE_BLACKLIST . " (customers_id, ban_customer, description, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, date_added) values ('" . $cust['customers_id'] . "', '" . $ban . "', '" . $reason . "', '" . $address['customers_street_address'] . "', '" . $address['customers_postcode'] . "', '" . $address['customers_postcode'] . "', '" . $address['customers_city'] . "', '" . $address['customers_state'] . "', now() )") or die('');

 

But when I try to insert a customer into the blacklist table nothing gets inserted. What am I missing here?

 

// Fredrik

Share this post


Link to post
Share on other sites

I have just finished installing this contrib and I think I may have missed something. Everything seems to look fine in admin, but it isn't pulling up any of my customers from the customer table. How do I get the customer names to show in the left drop down so I can add them to blacklist?

Share this post


Link to post
Share on other sites

The code for doing that just uses standard oscommerce code. I can't think of any reason why it would not load the customers.

 

Jack

Share this post


Link to post
Share on other sites

Jack,

 

This query appears to be the problem...

 

$customers_query = tep_db_query("SELECT customers_id, customers_firstname, customers_lastname FROM " . TABLE_CUSTOMERS . " where customers_firstname = '" . $names[0] . "' AND customers_lastname = '" . $names[1] . "'");

$cust = tep_db_fetch_array($customers_query);

$reason = $_POST['blacklist_reason'];

$ban = ($_POST['ban_customer'] == 'on') ? '1' : '0';

 

When I ran the sql in phpMyAdmin, it didn't find any records as written. I had to remove the "Where" clause to get any results. I am not sure if the rest of the contrib will work if I remove that portion of code though since there are attributes attached to the where conditions.

Share this post


Link to post
Share on other sites

Look farther down. This is the code that builds the list

  $customers = array();
 $customers_query = tep_db_query("SELECT customers_id, customers_lastname FROM " . TABLE_CUSTOMERS . " ORDER by " . $sort_order . " ASC");
 while ($list = tep_db_fetch_array($customers_query))
 {
$customer_name = tep_customers_name($list['customers_id']); 
$customers[] = array('id' => $customer_name, 'text' => $customer_name);
 }

 

Jack

Share this post


Link to post
Share on other sites

G'day,

 

When I try and login, I get this error.

 

1146 - Table 'savestra_osc1.TABLE_BLACKLIST' doesn't exist

 

SELECT c.customers_id, b.customers_id, b.ban_customer, b.description FROM customers c, TABLE_BLACKLIST b WHERE b.customers_id = '2'

 

[TEP STOP]

 

I know this means that the table doesnt exists but it does, I double checked it. here what have I missed?

 

CREATE TABLE blacklist (

customers_id int(13) NOT NULL default '0',

ban_customer tinyint(1) NOT NULL default '0',

attempted_use tinyint(1) NOT NULL default '0',

description varchar(255) default NULL,

entry_street_address varchar(64) NOT NULL,

entry_suburb varchar(32),

entry_postcode varchar(10) NOT NULL,

entry_city varchar(32) NOT NULL,

entry_state varchar(32),

date_added datetime NOT NULL default '0000-00-00 00:00:00'

) TYPE=MyISAM;

Share this post


Link to post
Share on other sites

An error where there are capital letters like that usually means the definition is missing, not the table itself. So you should check the includes/database.php file to make sure you have added the required code.

 

Jack

Share this post


Link to post
Share on other sites

thank you for making this extremely useful contribution jack mcs :)

 

what happens if somebody has a banned address in the database like:

24242 w. state st.

 

but they re-order with:

24242 west state street

 

will the blacklist alert work in this case?

i got rid of the check for the customer id because i clear out the customer accounts periodically if a customer hasn't logged in, so the blacklist relies on the address, city, state & zip to check.

Share this post


Link to post
Share on other sites

Yes, the code could be changed to check for changes in the address that way but it doesn't do it now.

 

Jack

Share this post


Link to post
Share on other sites

approximately how difficult would it be to add those changes? any tips on how to approach it?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×