Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - samurai-lupin

Pages: [1]
1
Items / Problem defining an item
« on: March 28, 2008, 12:28:27 pm »
Hello,

I was trying to define an item based on the EmailAdmin.php code:

My item is supposed to do the following:

When a member uses it, he will be asked for his name, e-maill and address (through input fields). This data should be sent to me (webmaster). Finally the item should get removed from the uses inventory.

The cause for this is that members can exchange their credits for real things in my shop and I will mail those to them. Therefore I need their name, address etc.

I have tried to modify the EmailAdmin item but encountered a problem:

The item will ask the user only for his e-mail but NOT his name and address?

I am attaching my item's code and am wondering what I did wrong? Thanks for any thoughts!

Code: [Select]
<?php
/**********************************************************************************
* SMFShop item                                                                    *
***********************************************************************************
* SMFShop: Shop MOD for Simple Machines Forum                                     *
* =============================================================================== *
* Software Version:           SMFShop 3.0 (Build 12)                              *
* $Date:: 2007-01-18 19:26:55 +1100 (Thu, 18 Jan 2007)                          $ *
* $Id:: EmailAdmin.php 79 2007-01-18 08:26:55Z daniel15                         $ *
* Software by:                DanSoft Australia (http://www.dansoftaustralia.net/)*
* Copyright 2005-2007 by:     DanSoft Australia (http://www.dansoftaustralia.net/)*
* Support, News, Updates at:  http://www.dansoftaustralia.net/                    *
*                                                                                 *
* Forum software by:          Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006-2007 by:     Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version of the license can always be found at                        *
* http://www.simplemachines.org.                                                  *
**********************************************************************************/

if (!defined('SMF'))
die('Hacking attempt...');

class 
item_EmailAdmin extends itemTemplate
{

function getItemDetails()
{
$this->authorName '';
$this->authorWeb '';
$this->authorEmail 'Neuer Artikel';

$this->name '';
$this->desc '';
$this->price 10;

$this->require_input true;
$this->can_use_item true;
$this->addInput_editable true;
}

function getAddInput()
{
global $item_info;
if ($item_info[3] == ''$item_info[3] = 'Ihre e-mail: <input type="text" name="e-mail" />';
            if (
$item_info[4] == ''$item_info[4] = 'Ihr Name: <input type="text" name="name" />';
            if (
$item_info[5] == ''$item_info[5] = 'Ihre Adresse: <input type="text" name="adresse" />';

    return '<br>
                        <br>
<table cellpadding=2 cellspacing=0 border=0>

<tr><td>Ihre e-mail:</td><td><input type="text" name="info1" size="50" value="webmaster@thunting.com" /></td></tr>
<tr><td>Betreff:<br></td><td><input type="text" name="info2" size="50" value="detektorforum.de Shop Artikel Versand" /></td></tr>
<tr><td>Nachricht:</td><td><textarea name="info6" rows="1" cols="50"/>Folgender Artikel wurde eben gekauft</textarea></td></tr>
                          
                        </table>

<br>
                        <br>

Zusatzfelder:
<p/>
<textarea name="info3" rows="1" cols="50">' 
$item_info[3] . '</textarea><br />

<textarea name="info4" rows="1" cols="50">' 
$item_info[4] . '</textarea><br />

<textarea name="info5" rows="1" cols="50">' 
$item_info[5] . '</textarea><br />

'
;
}

function getUseInput()
{
global $item_info;
// The 'additional fields needed' entered during item setup
return $item_info[3];
return $item_info[4];
return $item_info[5];
}

function onUse()
{
global $sourcedir$item_info;
$to $item_info[1];
$subject $item_info[2];
$message $item_info[3];
$message $item_info[4];
            
$message $item_info[5];

// We need sendmail!
require_once($sourcedir '/Subs-Post.php');

// Hack put in place to allow $_POST and $_GET vars in the $message var
// --Daniel15, 4 Septemeber 2005 2:15PM
foreach ($_POST as $postKey => $postVar)
$message str_replace('{$_POST["' $postKey '"]}'$postVar$message);
  
foreach ($_GET as $getKey => $getVar)
$message str_replace('{$_GET["' $getKey '"]}'$getVar$message);

// Send the email!
sendmail($to$subject$message) or die('Error sending message to admin! Please inform the Admin of this error. This item will still be available in your inventory.');

return 'Message sent to admin!';
}
}


?>


Thank you!

2
Coding / Re: Which files uses $txt['shop_add_item_message']
« on: April 22, 2007, 08:42:43 am »
Thank you Daniel!

3
Coding / Which files uses $txt['shop_add_item_message']
« on: April 21, 2007, 05:01:48 am »
Hello Daniel,

could you please let me know which files uses $txt['shop_add_item_message'] etc. as I would like to make some changes to the look of the screen where I can add a new item.

Thank you,

Christian

4
Coding / Re: Confirmation Mail after Item Purchase
« on: April 15, 2007, 12:09:22 pm »
Thank you very much Daniel! I really appreciate it!

5
Coding / Confirmation Mail after Item Purchase
« on: April 14, 2007, 12:17:59 am »
Hello!

I would like to modify my Shop 3.0 code so that it sends me an e-mail whenever someone purchases an item from my store.

If anyone knows how to modify the code for this purpose please kindly let me know.

Best wishes,

Christian

Pages: [1]