Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 ... 11 12 13 14 [15] 16 17 18 19 ... 22   Go Down

Author Topic: cpgShop - a PayPal shopping cart  (Read 250854 times)

0 Members and 1 Guest are viewing this topic.

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
Address not changeable in order process
« Reply #280 on: December 27, 2012, 02:29:29 pm »

Hi Stramm

While implementing an "user data exchange" inside the coppermine shop with a bridged Joomla 2.5 i noticed some mistake in one of the querys.
Class: HTMLelement::check_user_info()

here the fixed snipped (marked with "FCA 20121227 - fixed query"):
Code: [Select]
//we save the billing address in the users table if not bridged
if (UDB_INTEGRATION == 'coppermine' && $type == 0 ) {
$result = cpgDB::runQuery("UPDATE {$CONFIG['TABLE_USERS']} SET title = '$title', surename = '$surename', lastname = '$lastname', street = '$street', city = '$city', zip = '$zip', state = '$state', phone = '$phone', country = '$country' WHERE user_id = '".USER_ID."';");
} else {
$data = cpgDB::fetchRow("SELECT sid FROM {$CONFIG['TABLE_CS_ADDRESS']}  WHERE type = {$type} AND user_id ='" . USER_ID . "' ");
//a shipping address already exists -> update
if(isset($data['sid'])){
//FCA 20121227 - fixed query
//$result = cpgDB::runQuery("UPDATE {$CONFIG['TABLE_CS_ADDRESS']} SET title = '$title', surename = '$surename', lastname = '$lastname', street = '$street', city = '$city', zip = '$zip', state = '$state', phone = '$phone', country = '$country' WHERE sid = '{$data[sid]}';");
$result = cpgDB::runQuery("UPDATE {$CONFIG['TABLE_CS_ADDRESS']} SET title = '$title', surename = '$surename', lastname = '$lastname', street = '$street', city = '$city', zip = '$zip', state = '$state', phone = '$phone', country = '$country' WHERE sid = '{$data['sid']}';");
} else {
//insert new shipping address
cpgDB::runQuery("INSERT INTO `{$CONFIG['TABLE_CS_ADDRESS']}`
    (sid, user_id, type, title, surename, lastname, street, city, zip, state, phone, country)
    VALUES
    ('','".USER_ID."', '$type', '$title', '$surename','$lastname','$street', '$city', '$zip', '$state', '$phone', '$country');");
}

Logged

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
Re: cpgShop - a PayPal shopping cart
« Reply #281 on: December 28, 2012, 02:19:34 pm »

Hi Stramm

I may suggest an addition for definition of a shipping address. in the original implementation, the fields are all blank if the user wants to define a shipping address the first time.
Normally the personal data stays the same and only some address parts change. So it would be, from my point of view, good if the user data from the billing address will be used as prefill for the shipping address.
Therefor I added some lines to the cpgHTML.class.php file inside the function edit_address().
Maybe you want to takeover this for the original version:
Code: [Select]
                //FCA 20121228
                //if no shipping address exists, prefill with billing address
                if(empty($prefill)){
                $prefill = cpgDB::fetchRow("SELECT sid, title, surename, lastname, street, city, zip, state, phone, country FROM {$CONFIG['TABLE_CS_ADDRESS']}  WHERE type ='0'  AND user_id ='" . USER_ID . "' ");
                }

complete function:
Code: [Select]
    // -----------------------------------------------------------------------------------------
    // EDIT/ ADD ADDRESS --- atm used for shipping address
    // -----------------------------------------------------------------------------------------
    function edit_address()
    {
        global $CONFIG;
        global $lang_cs_profile, $lang_common, $lang_cs_cart, $lang_cs_error, $icon_array, $cpg_udb, $user_id, $cpgshop;

        if (!is_object($cpgshop)) $cpgshop = new cpgShop();
        // check no item and logged in
        cpgTool::check_enabled();
        cpgTool::check_cart($cpgshop);
        cpgTool::check_user();
        // delete shipping address
        $task = cpgTool::get_var('task');
        if ($task == 'delsph') {
            $result = cpgDB::runQuery("DELETE FROM `{$CONFIG['TABLE_CS_ADDRESS']}` WHERE type = '1' AND user_id = '" . USER_ID . "' LIMIT 1;");
            if ($result) {
                msg_box($lang_cs_cart['success'], $lang_cs_cart['shipping_adr_deleted'], "<span class=\"button button_normalfont\">" . $lang_common['continue'] . "</span>", "index.php?file=cpgshop/cpgshop_cart&page=verify_address", 'success');
            }
        } else {
            // shipping or billing address
            if (cpgTool::post_var('type') == false) {
                $type = cpgTool::get_var('type');
            } else {
                $type = cpgTool::post_var('type');
            }
            if (!$type) $type = '0'; //get/post don't like 0 so we set to 0 if null
            if (UDB_INTEGRATION == 'coppermine' && $type == 0) {
                $prefill = $cpg_udb->get_user_infos(USER_ID);
            } else {
                $prefill = cpgDB::fetchRow("SELECT sid, title, surename, lastname, street, city, zip, state, phone, country FROM {$CONFIG['TABLE_CS_ADDRESS']}  WHERE type ='" . $type . "'  AND user_id ='" . USER_ID . "' ");
                //FCA 20121228
                //if no shipping address exists, prefill with billing address
                if(empty($prefill)){
                $prefill = cpgDB::fetchRow("SELECT sid, title, surename, lastname, street, city, zip, state, phone, country FROM {$CONFIG['TABLE_CS_ADDRESS']}  WHERE type ='0'  AND user_id ='" . USER_ID . "' ");
                }
            }

            $required = cpgTool::required_fields();
            foreach($prefill as $key => $data) {
                if ($key == 'country') {
                    $data = cpgTool::country_by_code($data);
                }
                if ($key == 'title') {
                    $data = $lang_cs_profile["$data"];
                }
                if ($required[$key] == 1) {
                    $lang_cs_profile[$key] .= "<span class=\"smallfont\"> *</span>";
                }
            }

            $def_array = cpgTool::profile_definition_array();
            $form_data[] = array('select', 'title', $icon_array['blank'] . $lang_cs_profile['title'], cpgTool::profile_titles());
            foreach ($def_array as $key) {
                if ($key == 'country' || $key == 'title') continue;
                $form_data[] = array('input', $key, $icon_array['blank'] . $lang_cs_profile["$key"], 255);
            }
            $form_data[] = array('select', 'country', $icon_array['blank'] . $lang_cs_profile['country'], cpgTool::countries());
            $form_data[] = array('hidden', 'type', $type);

            echo <<<EOT
    <form name="cpgform" id="cpgform" method="post" action="index.php?file=cpgshop/cpgshop_cart&page=edit_address&type={$type}" onsubmit="return checkRegisterFormSubmit();">

EOT;
            starttable($CONFIG['picture_table_width'], $lang_cs_profile[$type], 2);
            HTMLelement::edit_address_form($form_data, $prefill);
            endtable();
            echo <<<EOT
    </form>
EOT;
        }
        return;
    }
Logged

TheCosmo

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
cpgShop: french translation
« Reply #282 on: December 28, 2012, 03:22:15 pm »

Hi Stramm,

Would you be interested in an enhanced french translation? I've seen in basic version of the package a translation file, with some untranslated and other mis-translated items.

As a donation for accessing the full version, would you accept translation files?

Cheers,

Cosmo
Logged

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
Bug in DOMPDF ?! -fixed-
« Reply #283 on: December 28, 2012, 05:25:32 pm »

Hi Stramm

It seems like there is an error in the file "dompdf_config.inc.php" which has been modified by you according to the original version of DOMPDF.
There is a typo in here:
Code: [Select]
/**
 * DOMPDF autoload function
 *
 * If you have an existing autoload function, add a call to this function
 * from your existing __autoload() implementation.
 *
 * @param string $class
 */
function DOMPDF_autoload($class) {
  $filename = mb_strtolower($class) . ".cls.php";
  require_once(DOMPDF_INC_DIR . "/$filename");
}

corrected version:
Code: [Select]
function DOMPDF_autoload($class) {
  $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
  if(is_file($filename)){
  require_once($filename);
  }
}

But this alone brought also an error up in my implementation of the shop due some mislink.
I checked the version 0.6 of DOMPDF and found that there is a file named "autoload.inc.php" linked with some additional code.
By implementing this into the version of the shop, the autoloader of the class works, so i add here the complete autoloader logic for the file "dompdf_config.inc.php" as replacement:
Code: [Select]
/**
 * DOMPDF autoload function
 *
 * If you have an existing autoload function, add a call to this function
 * from your existing __autoload() implementation.
 *
 * @param string $class
 */
//function DOMPDF_autoload($class) {
//  $filename = mb_strtolower($class) . ".cls.php";
//  require_once(DOMPDF_INC_DIR . "/$filename");
//}
function DOMPDF_autoload($class) {
  $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
  if(is_file($filename)){
  require_once($filename);
  }
}
// If SPL autoload functions are available (PHP >= 5.1.2)
if ( function_exists("spl_autoload_register") ) {
  $autoload = "DOMPDF_autoload";
  $funcs = spl_autoload_functions();
 
  // No functions currently in the stack.
  if ( !DOMPDF_AUTOLOAD_PREPEND || $funcs === false ) {
    spl_autoload_register($autoload);
  }
 
  // If PHP >= 5.3 the $prepend argument is available
  else if ( PHP_VERSION_ID >= 50300 ) {
    spl_autoload_register($autoload, true, true);
  }
 
  else {
    // Unregister existing autoloaders...
    $compat = (PHP_VERSION_ID <= 50102 && PHP_VERSION_ID >= 50100);
             
    foreach ($funcs as $func) {
      if (is_array($func)) {
        // :TRICKY: There are some compatibility issues and some
        // places where we need to error out
        $reflector = new ReflectionMethod($func[0], $func[1]);
        if (!$reflector->isStatic()) {
          throw new Exception('This function is not compatible with non-static object methods due to PHP Bug #44144.');
        }
       
        // Suprisingly, spl_autoload_register supports the
        // Class::staticMethod callback format, although call_user_func doesn't
        if ($compat) $func = implode('::', $func);
      }
     
      spl_autoload_unregister($func);
    }
   
    // Register the new one, thus putting it at the front of the stack...
    spl_autoload_register($autoload);
   
    // Now, go back and re-register all of our old ones.
    foreach ($funcs as $func) {
      spl_autoload_register($func);
    }
   
    // Be polite and ensure that userland autoload gets retained
    if ( function_exists("__autoload") ) {
      spl_autoload_register("__autoload");
    }
  }
}
if ( !function_exists("__autoload") ) {
  /**
   * Default __autoload() function
   *
   * @param string $class
   */
  function __autoload($class) {
    DOMPDF_autoload($class);
  }
}

// ### End of user-configurable options ###
Logged

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
view order: missing data
« Reply #284 on: December 29, 2012, 05:48:44 pm »

Hi Stramm

It seems there is another little bug in the order display detail page.
The header starts with the back button and a title that should display order number and date.
But due a lack in the language files an the code, this will not happen.
For example it is displayed as
Quote
Details der Bestellung: Bestell-Nr
and not as
Quote
Details der Bestellung: Bestell-Nr 30 vom 28. Dezember 2012 um 15:15
I first thought it was my fault by editing the language file not correctly, but the english translation has the same missing data, so its a general bug.

To fix this, as first the language file needs to be corrected:
  • search for orderid in german.php and replace the string behind from "Bestell-Nr" to "Bestell-Nr %s vom %s"
  • search for orderid in english.php and replace the string behind from "Order ID" to "Order ID %s dated from %s"
As second, an unset variable must be set. Therefore inside the cpgHTML.class.php search for
Code: (PHP) [Select]
                // start with the output of the back button
                starttable($CONFIG['picture_table_width'], $lang_cs_order['order_detail'] . ': ' . sprintf($lang_cs_order['orderid'], $oid, $date)); // .$lang_cs_order['orderid'] . ' ' . $oid . ' - ' . $date);
Replace it with:
Code: (PHP) [Select]
                if($result['time'] != 0) {
                $date = localised_date($result['time'], $lang_date['log']);
                }
                // start with the output of the back button
                starttable($CONFIG['picture_table_width'], $lang_cs_order['order_detail'] . ': ' . sprintf($lang_cs_order['orderid'], $oid, $date)); // .$lang_cs_order['orderid'] . ' ' . $oid . ' - ' . $date);
(It should exist two times, one in the history function and one in the order function, both need to be corrected as far as i can see)

Little remark at the end:
From my point of view the textarea field for the additional info the user may have added is wasting some possible space. This can be fixed by increasing the line number for it.

Therefore inside the cpgHTML.class.php search for
Code: (PHP) [Select]
'{TEXTFIELD}' => HTMLElement::text_area('additional_info', $additional_info, 50, 4)
and replace it with
Code: (PHP) [Select]
'{TEXTFIELD}' => HTMLElement::text_area('additional_info', $additional_info, 50, 8)
little image attached how it shouls look like :)
Logged

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
additional user data for invoice
« Reply #285 on: December 30, 2012, 03:30:16 pm »

Hi Stramm

I'm working atm on the invoice the user will be send via mail, and if enabled with pdf attachment.
It would be nice, if some more elements of the user data are available, like surename and lastname.

I therefore extended the function "cpgshop_order_confirmation_mail" inside the "cpgTool.class.php".
marked with
Quote
//FCA 20121230 added
Code: (PHP) [Select]
//send email to customer
$html_mail = cpgTemplate::set(html_entity_decode($MAIL['email_checkout_user_html']), array(
'{DATE}' => localised_date(-1, $lang_date['register']),
'{CUSTOMER_ADDRESS}' => $billing_address_html,
'{SITENAME}' => $CONFIG['gallery_name'],
'{TITLE}' => $billing_user_title,
'{LASTNAME}' => $user_data['lastname'],
'{ORDER_ID}' => $oid,
'{PAYMENT}' => $payment_info_html,
'{LINK}' => $link_html,
'{SHOP_ADDRESS}' => html_entity_decode($MAIL['email_checkout_address_html']),
'{CART}' => $cart_html,
//FCA 20121230 added
'{LASTNAME}' => $user_data['lastname'],
'{SURENAME}' => $user_data['surename'],
'{CUSTOMER_ID}' => $user_id,
));
$txt_mail = cpgTemplate::set(html_entity_decode($MAIL['email_checkout_user_txt']), array(
'{DATE}' => localised_date(-1, $lang_date['register']),
'{CUSTOMER_ADDRESS}' => str_replace("<br>", "\n", $billing_address_html),
'{SITENAME}' => $CONFIG['gallery_name'],
'{TITLE}' => $billing_user_title,
'{LASTNAME}' => $user_data['lastname'],
'{ORDER_ID}' => $oid,
'{PAYMENT}' => $payment_info_txt,
'{LINK}' => $link_txt,
'{SHOP_ADDRESS}' => html_entity_decode($MAIL['email_checkout_address_txt']),
'{CART}' => $cart_txt,
//FCA 20121230 added
'{LASTNAME}' => $user_data['lastname'],
'{SURENAME}' => $user_data['surename'],
'{CUSTOMER_ID}' => $user_id,
));

require_once('include'.DS.'mailer.inc.php');
if($CONFIG['cpgshop_pdf_invoice']){
require_once('plugins'.DS.'cpgshop'.DS.'libs'.DS.'pdf'.DS.'dompdf_config.inc.php');

$pdf_mail = cpgTemplate::set(html_entity_decode($MAIL['email_checkout_user_pdf']), array(
'{DATE}' => localised_date(-1, $lang_date['register']),
'{CUSTOMER_ADDRESS}' => $billing_address_html,
'{SITENAME}' => $CONFIG['gallery_name'],
'{TITLE}' => $billing_user_title,
'{LASTNAME}' => $user_data['lastname'],
'{ORDER_ID}' => $oid,
'{PAYMENT}' => '',
'{SHOP_ADDRESS}' => html_entity_decode($MAIL['email_checkout_address_html']),
'{CART}' => $cart_html,
//FCA 20121230 added
'{LASTNAME}' => $user_data['lastname'],
'{SURENAME}' => $user_data['surename'],
'{CUSTOMER_ID}' => $user_id,
));
Would be nice if these addition will make it into the next release.
Logged

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
cpgShop - DOMPDF 0.6
« Reply #286 on: December 31, 2012, 01:53:37 pm »

Hi Stramm

I just replaced the DOMPDF implementation of version 0.5.1 with 0.6.0beta3 and it seems to be running nearly fine out of the box.
This allows more detailed CSS controlled invoices :)

So my post earlier from the 28th becomes partly obsolete if you would implement that release of DOMPDF in your next shop release.

ATM i have some trouble with the basepath that can be set. Seems not to be working correctly, but i'm on it...
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4683
    • Windsurf.me
Re: cpgShop - a PayPal shopping cart
« Reply #287 on: January 03, 2013, 03:36:32 pm »

Feel free to contribute your work DesMas.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
Re: cpgShop - a PayPal shopping cart
« Reply #288 on: January 05, 2013, 09:32:51 pm »

Hi Stramm

I'm still at to point to build up a complete invoice as PDF that satisfies the given law restrictions; and by this also has a nice layout..
Therefore i have come to the conclusion, that th shop should have an extra section in the "cpgShop configuration", that gives the admin the possibility to declare some properties for a more dynamically usage inside the generated mails and invoice.

To solve this a few files have to be modified:
- First, the admin.inc.php need a new subarray inside the config_data array:
Code: (PHP) [Select]
'cpgshop_shopcontact' => array(
'cpgshop_shopcontact_name' => array(
'type' => 'textfield',
),
'cpgshop_shopcontact_street' => array(
'type' => 'textfield',
),
'cpgshop_shopcontact_zip' => array(
'type' => 'textfield',
),
'cpgshop_shopcontact_city' => array(
'type' => 'textfield',
),
'cpgshop_shopcontact_phone' => array(
'type' => 'textfield',
),
'cpgshop_shopcontact_fax' => array(
'type' => 'textfield',
),
'cpgshop_shopcontact_mobile' => array(
'type' => 'textfield',
),
'cpgshop_shopcontact_mail' => array(
'type' => 'textfield',
),
),

- This will also need some new language tags, which i added to $lang_cs_config array inside the german.php.
(for other languages this has to be redone)
Code: (PHP) [Select]
'cpgshop_shopcontact' => "erweiterte Kontakdaten",
'cpgshop_shopcontact_name' => "Name / Ansprechpartner",
'cpgshop_shopcontact_street' => "Strasse",
'cpgshop_shopcontact_zip' => "Postleitzahl",
'cpgshop_shopcontact_city' => "Stadt",
'cpgshop_shopcontact_phone' => "Tel-Nr.",
'cpgshop_shopcontact_fax' => "Fax",
'cpgshop_shopcontact_mobile' => "Mobil",
'cpgshop_shopcontact_mail' => "E-Mail",

- As third we need some new fields inside the database table for the config, which can be simply done with
Code: (SQL) [Select]
Insert into cpg_cpgshop_config (`name`,`value`) Values
('cpgshop_shopcontact_name', ''),
('cpgshop_shopcontact_street', ''), 
('cpgshop_shopcontact_zip', ''),
('cpgshop_shopcontact_city', ''),
('cpgshop_shopcontact_phone', ''),
('cpgshop_shopcontact_fax', ''),
('cpgshop_shopcontact_mobile', ''), 
('cpgshop_shopcontact_mail', '');

Now we have a new section inside the configuration to define values for this :)

To bring them to live inside the mails the function "cpgshop_order_confirmation_mail()" inside the "cpgTool.class.php" needs some extension.
As in a earlier post it are the variables "$html_mail", "$txt_mail", "$pdf_mail" where we need to extend with:
Code: (PHP) [Select]
'{SHOP_MAIL}' => $CONFIG['cpgshop_notify_email'],
'{SHOP_ROUTING}' => $CONFIG['cpgshop_wire_routing'],
'{SHOP_ACCOUNT}' => $CONFIG['cpgshop_wire_account'],
'{SHOP_BANK}' => $CONFIG['cpgshop_wire_bank'],
'{SHOP_SWIFT}' => $CONFIG['cpgshop_wire_swift'],
'{GALLERY_NAME}' => $CONFIG['gallery_name'],
'{SHOP_NAME}' => $CONFIG['cpgshop_shopcontact_name'],
'{SHOP_STREET}' => $CONFIG['cpgshop_shopcontact_street'],
'{SHOP_ZIP}' => $CONFIG['cpgshop_shopcontact_zip'],
'{SHOP_CITY}' => $CONFIG['cpgshop_shopcontact_city'],
'{SHOP_PHONE}' => $CONFIG['cpgshop_shopcontact_phone'],
'{SHOP_FAX}' => $CONFIG['cpgshop_shopcontact_fax'],
'{SHOP_MOBILE}' => $CONFIG['cpgshop_shopcontact_mobile'],
'{SHOP_MAIL}' => $CONFIG['cpgshop_shopcontact_mail'],

With this we now have the ability to use these {} tags inside the documents "email_checkout_user_pdf" as well as "email_checkout_address_html"

By adding this i noticed that there is atm no tag existing for the invoice date, that is listing the correct date if the admin is resending the invoice.
To fix this, the function "cpgshop_order_confirmation_mail()" inside the "cpgTool.class.php" need again to be extended.

Directly below the line:
Code: (PHP) [Select]
$user_info = $cpg_udb->get_user_infos($user_id);

i added the following:
Code: (PHP) [Select]
$result = cpgDB::fetchRow("SELECT time FROM {$CONFIG['TABLE_CS_ORDER']} WHERE oid='" . $oid . "' LIMIT 1;");
$orderDate = $result['time'];
mysql_free_result($result);

Now we can use the date for a tag inside the variables "$html_mail", "$txt_mail", "$pdf_mail" where we ad it as
Code: (PHP) [Select]
'{ORDER_DATE}' => localised_date($orderDate, $lang_date['register']),

I'm looking forward that u will find this extension idea useful and transfer them into your source code.

I think i will add a pdf example for an invoice and the html source the next days that show the results :)

//EDIT 06.01.2013
It seems that the wire data for the shop config is missing also an IBAN field.
To add this only a few things need to be adjusted:
- inside the language file (here german.php) add the following entry to the $lang_cs_config array
Code: (PHP) [Select]
'cpgshop_wire_iban' => "IBAN",
as it seems, the language file is there not totally free of redundancy, so a corresponding entry should also be added to the $lang_cs_cart array:
Code: (PHP) [Select]
'wire_iban' => "IBAN",

- inside the admin.inc.php add the following code snippet
Code: (PHP) [Select]
'cpgshop_wire_iban' => array(
  'type'      => 'textfield',
),
below this snipped:
Code: (PHP) [Select]
'cpgshop_wire_bank_address' => array(
  'type'      => 'textfield',
),

- now we only need a database field entry for the config which can be created via the phpadmin console with
Code: (SQL) [Select]
Insert into cpg_cpgshop_config (`name`,`value`) Values('cpgshop_wire_iban', '')

- as the wire information is loaded dynamically, only the html processing thank_you() inside the cpghtml.class.php need to be extended a little (marked with  //FCA 20130106 added):
Code: (PHP) [Select]
// atm we just need that to populate the paypal button
            switch ($cpgshop->profile['gateway']['method']) {
                case ('paypal'):
                    $billing_extra_info = "{$LINEBREAK}<div align=\"center\">" . HTMLElement::paypal_button($oid) . "</div>";
                    break;
                case ('wire'):
                    $billing_info_array = array($lang_cs_cart['wire_routing'] . ':' => html_entity_decode($CONFIG['cpgshop_wire_routing']),
                        $lang_cs_cart['wire_account'] . ':' => html_entity_decode($CONFIG['cpgshop_wire_account']),
                        $lang_cs_cart['wire_bank'] . ':' => html_entity_decode($CONFIG['cpgshop_wire_bank']),
                        $lang_cs_cart['wire_bank_address'] . ':' => html_entity_decode($CONFIG['cpgshop_wire_bank_address']),
                        $lang_cs_cart['wire_swift'] . ':' => html_entity_decode($CONFIG['cpgshop_wire_swift']),
                        //FCA 20130106 added
                        $lang_cs_cart['wire_iban'] . ':' => html_entity_decode($CONFIG['cpgshop_wire_iban']),
                        );
                    $gateway_extra_text .= "</td></tr><tr><td><table width=\"80%\"align=\"center\">";
                    foreach($billing_info_array as $key => $data) {
                        if ($key)
                            $gateway_extra_text .= "<tr><td width=\"50%\" align=\"right\"><strong>{$key}</strong></td><td width=\"50%\">{$data}</td></tr>\n";
                    }

                    $gateway_extra_text .= "</table></td></tr><tr><td class=\"thank_you\">";

                    break;
                case ('cod'):
                    break;
                default: ;
            //free download
            $billing_extra_info = "{$LINEBREAK}<div align=\"center\">" . $lang_cs_cart['free_download'] . "</div>";
            } // switch
« Last Edit: January 06, 2013, 05:33:25 pm by DesMas »
Logged

kristade

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: cpgShop - a PayPal shopping cart
« Reply #289 on: January 06, 2013, 06:57:13 pm »

Hi Stramm,

I am new to Coppermine and new to your shopping cart.  I tried to read through the forum to see if this question had been asked, but I did not see it.

I am going to be doing custom engraving for the customers and was wondering if there was a spot for the customer to leave  "custom text" for up to 4 lines of engraving? I hope this makes sense to you.

Thanks in advance for any help
Krista

Logged

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
Re: cpgShop - a PayPal shopping cart
« Reply #290 on: January 07, 2013, 08:55:31 pm »

Hi Stramm,

I am new to Coppermine and new to your shopping cart.  I tried to read through the forum to see if this question had been asked, but I did not see it.

I am going to be doing custom engraving for the customers and was wondering if there was a spot for the customer to leave  "custom text" for up to 4 lines of engraving? I hope this makes sense to you.

Thanks in advance for any help
Krista

Hi Krista

From my point of view of the code, there is no option to enter a "per image text" for the "item/picture" to purchase.
ATM there is only an option for the user to leave a custom message per order at the end of the "order process".
Logged

DesMas

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 31
    • VMM-IS
Re: cpgShop - a PayPal shopping cart
« Reply #291 on: January 13, 2013, 06:32:05 pm »

Hi Stramm

while creating the style of the invoice pdf i noticed, that the system does not support an invoice number for the created pdf files.
Due to the fact that most shop systems use their own syntax, i implemented a field inside the configuration to define a sinple syntax depending on the existing data.

What we need for this is:
- a little SQL tp extend the configuration
Code: (SQL) [Select]
INSERT INTO cpg_cpgshop_config( `name` , `value` )
VALUES (
'cpgshop_order_invoice_number', ''
)


- an extra field description in the admin.inc.php
add below
Code: (PHP) [Select]
'cpgshop_customer_cancel' => array(
  'type'          => 'radio',
  'options'       => array(
  $lang_cs_config['no'],
  $lang_cs_config['yes'],
  ),
),
the following:
Code: (PHP) [Select]
'cpgshop_order_invoice_number' => array(
'type'      => 'textfield',
),

- now we need some text in the language file for it (here german.php), added to the "$lang_cs_config" array
Code: (PHP) [Select]
'cpgshop_order_invoice_number' => "Rechnungsnummer. Sie können folgende Platzhalter verwenden: {CUSTOMER_ID} {ORDER_ID}, [YY]",

- To bring them to live inside the mail, the function "cpgshop_order_confirmation_mail()" inside the "cpgTool.class.php" needs some extension.
As in a earlier post it are the variables "$html_mail", "$txt_mail", "$pdf_mail" that need to be extended with:
(Add this as first entry to each array to be sure the placeholders inside will be replaced correctly)
Code: (PHP) [Select]
'{INVOICE_NUMBER}' => str_replace("[YY]", date("y"), $CONFIG['cpgshop_order_invoice_number']),

In the shop configuration, the invoice number can no be customized, f.ex like: "{CUSTOMER_ID}-IV-[YY]{ORDER_ID}"
This allows the admin to specify a number mixed out of fixed text, order-id, customer-id and a 2-digit year.

As posted earlier i add the html an css code to style a nicely invoice sheet:
- code for the document "email_checkout_user_pdf" (plz note that the css file has no relative path due to some lack in the basepath logic of DOMPDF that i could not resolve till now):
Code: (HTML) [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link media="all" type="text/css" rel="stylesheet" href="http://192.168.0.220/SSG3/coppermine/plugins/cpgshop/css/invoice.css">
</head>
<body>
<div id="head">
<div class="left w50percent text-center">
<img src="http://192.168.0.220/SSG3/coppermine/plugins/cpgshop/images/invoiceLogo.jpg" />
</div>
<div class="right w50percent">
{SHOP_ADDRESS}
</div>
<div class="w100percent clear">
<span class="addressline">{SHOP_NAME} - {SHOP_STREET} {SHOP_ZIP} {SHOP_CITY}</span>
</div>
<div class="w45percent left border">
<p class="text-left m5px">
{CUSTOMER_ADDRESS}
</p>
</div>
<div class="w45percent right border">
<p class="text-center">
<span class="text16px bold">Rechnung</span>
</p>
<p class="text-left m5px">
<table>
<tr>
<td>Rechnung-Datum:</td>
<td>{ORDER_DATE}</td>
</tr>
<tr>
<td>Rechnung-Nr:</td>
<td>{INVOICE_NUMBER}</td>
</tr>
<tr>
<td>Kunden-Nr:</td>
<td>{CUSTOMER_ID}</td>
</tr>
<tr>
<td>Bestell-Nr:</td>
<td>{ORDER_ID}</td>
</tr>
</table>
</p>
</div>
</div>
<div id="cart">
<div class="w100percent">
<p class="text-left">
<span class="text16px bold">Bestelldaten</span>
</p>
</div>
<table width="w100percent">{CART}</table>
</div>
<div id="footer">
<p class="text-left">
Frei von Umsatzsteuer gem. §19 Abs. 1 UStG.<br />
Zahlungsweise: Gesamtsumme ohne Abzüge innerhalb von 14 Tagen nach Rechnungszustellung
<br />
</p>
<table style="width: 100%">
<tr>
<td>E-Mail: {SHOP_MAIL}</td>
<td>Tel.: {SHOP_PHONE}</td>
<td>Fax: {SHOP_FAX}</td>
<td>Mobil: {SHOP_MOBILE}</td>
</tr>
</table>
<table style="width: 100%">
<tr>
<td>Bank: {SHOP_BANK}</td>
<td>Kto: {SHOP_ACCOUNT}</td>
<td>BLZ: {SHOP_ROUTING}</td>
<td>SWIFT: {SHOP_SWIFT}</td>
<td>IBAN: {SHOP_IBAN}</td>
</tr>
</table>
</div>
</body>
</html>

- the placeholder "{SHOP_ADDRESS}" is defined in the document "email_checkout_address_html"
Code: (HTML) [Select]
<p class="text-right">
<span class="shopname">{GALLERY_NAME}</span>
</p>
<p class="text-right">
<span class="shopaddress">
{SHOP_NAME}<br />
{SHOP_STREET}<br />
{SHOP_ZIP} {SHOP_CITY}
</span>
</p>
<p class="text-right">
<span class="shopcontact">
Tel.: {SHOP_PHONE}<br />
Fax.: {SHOP_FAX}<br />
Mobil: {SHOP_MOBILE}<br />
E-Mail: {SHOP_MAIL}
</span>
<p class="text-right">
<span class="shopcontact">
Kto: {SHOP_ACCOUNT} BLZ: {SHOP_ROUTING} Bank: {SHOP_BANK}
</span>
</p>

- The CSS file is located inside the css folder of the cpgshop (coppermine/plugins/cpgshop/css):
Code: (CSS) [Select]
html, body {
margin : 0;
padding : 0;
}

/* print margins */
body {
margin-left : 50px;
margin-right : 40px;
margin-top : 40px;
margin-bottom : 40px;
font-family : Verdana,Geneva,Arial,sans-serif;
font-size : 14px;
font-weight : normal;
}
/* specific tags */
#head {
width : 100%;
height : 400px;
overflow : auto;
display : block;
}
.logo {
background-image : url("http://192.168.0.220/SSG3/coppermine/plugins/cpgshop/images/invoiceLogo.jpg");
background-repeat : no-repeat;
background-position : top center;
height : 220px;
}
span.shopname {
font-weight : bold;
margin-bottom : 10px;
}
span.shopcontact {
margin-bottom : 10px;
}
span.addressline {
font-size : 9px;
text-decoration : underline;
margin-bottom : 10px;
display : block;
}
#cart {
width : 100%;
overflow : auto;
}
#footer {
position : fixed;
bottom : 70px;
height : 70px;
border-top : 2px ridge #000;
overflow : auto;
display : block;
width : 100%;
}
/* general tags */
p {
margin : 0px;
padding : 0px;
margin-bottom : 5px; 
}
.left {
float: left;
}
.right {
float: right;
}
.clear {
clear: both;
}
.w45percent {
width: 45%;
}
.w50percent {
width: 50%;
}
.w100percent {
width: 100%;
}
.border {
border: 1px solid #000;
}
.text-right {
text-align: right;
}
.text-left {
text-align: left;
}
.text-center {
text-align: center;
}
.text10px {
font-size: 10px;
}
.text12px {
font-size: 12px;
}
.text14px {
font-size: 14px;
}
.text16px {
font-size: 16px;
}
.normal {
font-weight: normal;
}
.bold {
font-weight: bold;
}
.m5px {
margin: 5px;
}

Plz note:
- this invoice sheet is only rendered correctly with DOMPDF >= 0.6.0
- relative path to the css file sees not to work
- background images of <div> tags seem not to work, so use an <img> tag for logos, etc
« Last Edit: January 13, 2013, 06:41:35 pm by DesMas »
Logged

mikezeta

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 12
Re: cpgShop - a PayPal shopping cart
« Reply #292 on: February 20, 2013, 04:12:40 am »

Hi Stramm

please send me a PM about donation for a full version.

Thank you

Best regards,
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: cpgShop - a PayPal shopping cart
« Reply #293 on: February 25, 2013, 02:53:13 pm »

Hi DesMas,
thanks for your efforts. I'll check into your changes and move everything working smooth into my cvs so it's included into the next version of the shop.

Thomas

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 784
    • GMC Design Photo Gallery
Re: cpgShop - a PayPal shopping cart
« Reply #294 on: March 19, 2013, 03:05:10 am »

Hi Stramm,
Thank you for your work on this plugin..
I've installed it to my gallery - and having a couple of issues:

When registering a new user - enter country, name, address, etc - yet when going to checkout, that information wasn't saved and has to be re-entered... Once entered during checkout, it seems to be saved for future.
I would expect this information to be saved during registration since it is prompted for.

If Cash on Delivery - Enable COD fee is set to no - a fee is still displayed when selecting COD unless COD fee is also set to 0... (It isn't added in to the final cart, but I would expect if the fee was not enabled, any specified fee value would be ignored?)

I want the user to have a choice of standard shipping or pickup...
I set options as:
   Parcel delivery settings:
   Enable a fee for standard delivery    Yes
   Fee for standard delivery       4.00
   Customers can pickup their items    Yes
   Enable pickup fee          No | Yes (I tried both values)
   Pickup fee             0.00   
The user doesn't seem to have a way to select pickup over shipping??

Notes on mods made:
In this gallery, I will only have ordering enabled for select albums - most people won't see it - so I didn't want the cart buttons on every page...
A quick mod to codebase.php (starting at line 267 of 1_0_4 version) only displays the cart buttons if there is something in them.
  //Add view cart & checkout buttons
  //* GMC - alter compare to suppress cart and checkout buttons if cart is empty..
  //* GMC if ($item_in_cart > -1 && $CONFIG['cpgshop_enable']) {
  if ($item_in_cart > 0 && $CONFIG['cpgshop_enable']) {  //* GMC changed compare to > 0
It does mean a user must have something in the cart to get the button to view their history - but worth the tradeoff I think.
(Would be nice to have a config option to show/not show these buttons based on empty cart...)

English language file (lang/english.php) updated to change text for 'Surename' to 'First name' (3 places) (someone mentioned this in earlier post - but seemed it hadn't been updated in the 1_0_4 zip file attahced to first post.)

Gallery info:
My gallery is at http://greggallery.gmcdesign.com  running Version 1.5.22
Plugins: minicms and shopcpg
Mods: cpmfetch
Test id: cpgtest  (non-admin)
Test pwd: testcpg
Ordering is ONLY turned on in a SINGLE album right now... Under 'Sporting Events' Album '2011 Coach Eric's 14U'.
Based on mod above - the cart buttons won't appear until an item is added to the cart.

Thanks for any help/suggestions you can provide.
Greg
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bladerunner

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: cpgShop - a PayPal shopping cart
« Reply #295 on: March 26, 2013, 10:04:19 pm »

italian translation front and back
Logged

hunterjo2

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: cpgShop - a PayPal shopping cart
« Reply #296 on: April 13, 2013, 05:32:42 pm »

Hi Stramm,

I am getting the following error after upgrading to 1.5.22 and upgrading cpgshop

Fatal error: Undefined class name 'self' in /rallyimage.com/gallery/plugins/cpgshop/libs/HTMLelement.class.php on line 806

Any ideas?
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: cpgShop - a PayPal shopping cart
« Reply #297 on: April 13, 2013, 07:07:15 pm »

You're still on PHP4?

azzy768

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: cpgShop - a PayPal shopping cart
« Reply #298 on: April 24, 2013, 04:50:06 pm »

Hi Guys, can anyone help please. I've set up coppermine 1.5.20 and cpgshop 1.0.3. Everything appears to be working ok except:
1. with multiple purchases which have a weight addition value - the value only shows for one purchase at the gateway stage and then in the total price.
2. The country charge shows correctly at the gateway stage but does not appear in the next stage in the total price.

Has anyone else come across this and found a solution? Please help!
Logged

mboesen

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 104
    • Boesen Photography & Design
Re: cpgShop - a PayPal shopping cart
« Reply #299 on: May 06, 2013, 10:31:53 am »

Hi Stramm

or anybody else who might have an answer

I have been having trouble with the registration of customers on the webshop on my website

http://www.boesenfoto.dk/gallery/index.php

The user register in Coppermine which works fine. Then they add photos and go to the check out procedure. On the first page, they are told that the address etc is missing (it is a shame that it just doesn't copy from the original registration). Then they enter all the information again hit next page only to be informed that the information is still missing.

If I just hit next anyway and procede to finalize the order... I get an error saying there is a problem with the address and it has been changed. Go back...

I have deleted the cpgshop and reinstalled it... version 1.0.4... But the problem remains...

Any suggestions?

BR, Michael
Logged
Pages: 1 ... 11 12 13 14 [15] 16 17 18 19 ... 22   Go Up
 

Page created in 0.079 seconds with 21 queries.