Jump to content

Greystoke

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Greystoke's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The "sales" Table: The "bonus" Table: The affiliate_id, affiliate_billing_staus, affiliate_payment_id are the same in both tables. The affiliate _id in both table is the same person. This is how I want it displayed: Using the Union option it displays correctly, but the "bonus" table may not always have a matching row for each affiliate. If the affiliate has no sales then the bonus won't be paid as that affiliate_id won't be checked for in the "bonus" table.
  2. The tables are been used in the invoice report to show a breakdown of the payments to the affiliate. The 2 tables are matched using the affiliate_payment_id. In the original invoice it only showed the sales breakdown. The affiliate_orders_id, affiliate_date, affiliate_value, affiliate_percent, affiliate_payment are used to for the report. This is how it looks using this: $affiliate_sales_query = tep_db_query("(select affiliate_orders_id, affiliate_date, affiliate_value, affiliate_percent, affiliate_payment from " . TABLE_AFFILIATE_SIGNUP_BONUS . " where affiliate_payment_id = '" . $payments['affiliate_payment_id'] . "' order by affiliate_payment_date desc) UNION (select affiliate_orders_id, affiliate_date, affiliate_value, affiliate_percent, affiliate_payment from " . TABLE_AFFILIATE_SALES . " where affiliate_payment_id = '" . $payments['affiliate_payment_id'] . "' order by affiliate_payment_date desc)");
  3. Hi fugix, The "bonus" table isn't always going to have a matching row for each affiliate in the "sales" table, I was trying do what MrAdam said, but I can't figure out how to get the LEFT JOIN to work correctly.
  4. Hi, Thanks for your replies. I went with the UNION option first: $affiliate_sales_query = tep_db_query("(select affiliate_orders_id, affiliate_date, affiliate_value, affiliate_percent, affiliate_payment from " . TABLE_AFFILIATE_SIGNUP_BONUS . " where affiliate_payment_id = '" . $payments['affiliate_payment_id'] . "' order by affiliate_payment_date desc) UNION (select affiliate_orders_id, affiliate_date, affiliate_value, affiliate_percent, affiliate_payment from " . TABLE_AFFILIATE_SALES . " where affiliate_payment_id = '" . $payments['affiliate_payment_id'] . "' order by affiliate_payment_date desc)"); This worked. Then after reading MRAdam post I tried to use LEFT JOIN, but it only outputted the sales info not both. $affiliate_sales_query = tep_db_query("select asb.*, s.* from " . TABLE_AFFILIATE_SALES . " s left join " . TABLE_AFFILIATE_SIGNUP_BONUS . " asb on (s.affiliate_id = asb.affiliate_id) where s.affiliate_payment_id = '" . $payments['affiliate_payment_id'] . "' order by asb.affiliate_payment_date desc"); Can anyone help with this please.
  5. Hi, I need some help getting results from 2 tables. Table sales: Table bonus: At the moment I have: $affiliate_sales_query = tep_db_query("select * from " . TABLE_AFFILIATE_SALES . " where affiliate_payment_id = 7 order by affiliate_payment_date desc"); while ($affiliate_sales = tep_db_fetch_array($affiliate_sales_query)) { ?> <tr class="dataTableRow"> <td class="dataTableContent" align="right" valign="top"><?php echo $affiliate_sales['affiliate_orders_id']; ?></td> <td class="dataTableContent" align="center" valign="top"><?php echo tep_date_short($affiliate_sales['affiliate_date']); ?></td> <td class="dataTableContent" align="right" valign="top"><b><?php echo $currencies->display_price($affiliate_sales['affiliate_value'], ''); ?></b></td> <td class="dataTableContent" align="right" valign="top"><?php echo $affiliate_sales['affiliate_percent']; ?><?php echo ENTRY_PERCENT; ?></td> <td class="dataTableContent" align="right" valign="top"><b><?php echo $currencies->display_price($affiliate_sales['affiliate_payment'], ''); ?></b></td> </tr> <?php } ?> This outputs the sales table like: How can I get it to also output the bonus table in the same report.
  6. Thanks for all your help. That's what I was looking for.
  7. Sorry about not posting the print_r correctly. What I want it to do is if 'pro_install' or 'custom_install' are not in the array, then redirect. E.g. If 'pro_install' is there don't redirect. or If 'custom_install' is there don't redirect. or If 'pro_install' and 'custom_install' are there don't redirect.
  8. Hi, I tried this, but it didn't work. $products = $cart->get_products(); print_r($products); if(!isset($products['pro_install']) || !isset($products['custom_install'])) { echo 'test'; } It still outputs 'test', even when 'pro_install' was in the Array.
  9. Hi, Can anyone help with this please. $products = $cart->get_products(); print_r('$products'); } print_r('$products'); outputs: Array ( [0] => Array ( [id] => 28{7}14 [name] => Pro Install [model] => pro_install [image] => [price] => 25.0000 [quantity] => 1 [weight] => 0.00 [final_price] => 25 [tax_class_id] => 0 [attributes] => Array ( [7] => 14 ) ) [1] => Array ( [id] => 25 [name] => Keyboard [model] => KB [image] => intkeyboardps2.gif [price] => 69.9900 [quantity] => 1 [weight] => 8.00 [final_price] => 69.99 [tax_class_id] => 1 [attributes] => ) ) How do I get it to check the Array for 2 values, 'pro_install' and 'custom_install'. If the values don't exits, I need it to redirect to index.php.
  10. Hi, How can I get it to show the Username instead of the userid. The Username is stored in a different Table in the database: CREATE TABLE `user` ( userid int(10) unsigned NOT NULL auto_increment, username varchar(100) collate utf8_unicode_ci NOT NULL default '', PRIMARY KEY (userid), KEY username (username), ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; -- -- Dumping data for table 'user' -- INSERT INTO `user` (userid, username) VALUES (1, 'Admin');
  11. That's just what I needed. Thank you.
  12. Can anyone help with this, please.
  13. Hi, Can anyone help with this please. <?php $check = tep_db_query("SELECT * FROM tickets ORDER BY `ticket` ASC"); while ($ticket = tep_db_fetch_array($check)) { print_r($ticket); ?> <div> <?php echo $ticket['userid']; ?></div> <div><?php echo $tickets_qty;?></div> <?php } ?> print_r($ticket); is outputting: Array ( [ticket] => 1 [userid] => 2 [day] => 8 [time] => 1299558047 [winner] => 0 ) Array ( [ticket] => 2 [userid] => 1 [day] => 8 [time] => 1299558236 [winner] => 0 ) Array ( [ticket] => 3 [userid] => 1 [day] => 8 [time] => 1299558047 [winner] => 0 ) Array ( [ticket] => 4 [userid] => 1 [day] => 8 [time] => 1299558236 [winner] => 0 ) What I want is for it to display the Userid and the number of tickets that user has. e.g. Userid_____________________Tickets 1___________________________3 2___________________________1
  14. Thank you
  15. Hi, Just trying to update the image link. The code is no longer supported by the coder, so trying to do it myself. I don't know why it was done that way.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.