Jump to:

2082 Posts in 1002 Topics by 452 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » How i got the latest eCommerce trunk to work with paypal

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1 2 3 4 5
Go to End
Author Topic: 6200 Views
  • marc79
    Avatar
    Community Member
    65 Posts

    Re: How i got the latest eCommerce trunk to work with paypal Link to this post

    A fresh install of 0.8.2 seems to have done it (was previously using 0.8.1). With the payment module of course and PaypalExpressCheckoutPayment.

    My config file looks like this:

    // copy the lines below to your mysite/_config.php file and set as required.
    // __________________________________START ECOMMERCE MODULE CONFIG __________________________________
    //The configuration below is not required, but allows you to customise your ecommerce application - check for the defalt value first.
    // * * * DEFINITELY MUST SET
    Order::set_email("your name <sales@myshop.com>");
    Order::set_receipt_subject("thank you for your order at www.myshop.com");
    Order::set_modifiers(array("SimpleShippingModifier"));

    // * * * HIGHLY RECOMMENDED SETTINGS NON-ECOMMERCE
    Payment::set_site_currency('GBP');
    Geoip::$default_country_code = "GB";
    i18n::set_locale('en_GB');
    //setlocale (LC_TIME, 'en_GB@dollar', 'en_GB.UTF-8', 'en_GB', 'gb', 'gb');

    // * * * ECOMMERCE I18N SETTINGS
    //EcommerceCurrency::setDecimalDelimiter(','); //for Money formating
    //EcommerceCurrency::setThousandDelimiter('.'); //for Money formating
    //Object::useCustomClass('SS_Datetime','I18nDatetime', true);

    // * * * SHOPPING CART AND ORDER
    //ShoppingCart::set_fixed_country_code("NZ"); //always use the same country code
    //Order::set_table_overview_fields(array('Total' => 'Total','Status' => 'Status'));//
    //Order::set_maximum_ignorable_sales_payments_difference(0.001);//sometimes there are small discrepancies in total (for various reasons)- here you can set the max allowed differences
    Order::set_order_id_start_number(001001);//sets a start number for order ID, so that they do not start at one.
    //Order::set_cancel_before_payment(false); //soon to be depreciated
    //Order::set_cancel_before_processing(false); //soon to be depreciated
    //Order::set_cancel_before_sending(false); //soon to be depreciated
    //Order::set_cancel_after_sending(false); //soon to be depreciated

    //OrderForm::set_user_membership_optional(); //optional for user to become a member
    OrderForm::set_force_membership(false); //all users must become members if true, or won't become members if false

    //OrderManipulation::set_allow_cancelling(); //shows a cancel button on the order page
    //OrderManipulation::set_allow_paying(); //shows a payment form

    // * * * PRODUCTS
    //ProductsAndGroupsModelAdmin::set_managed_models(array(("Product", "ProductGroup","ProductVariation"));
    //SS_Report::register("SideReport", "EcommerceSideReport_AllProducts");
    //SS_Report::register("SideReport", "EcommerceSideReport_FeaturedProducts");
    //SS_Report::register("SideReport", "EcommerceSideReport_NoImageProducts");
    //Product_Image::set_thumbnail_size(140, 100);
    //Product_Image::set_content_image_width(200);
    //Product_Image::set_large_image_width(200);
    //ProductGroup::set_include_child_groups(true);
    //ProductGroup::set_must_have_price(true);
    //ProductGroup::set_sort_options( array('Title' => 'Alphabetical','Price' => 'Lowest Price')); // will be depreciated soon in this form, WATCH THIS SPACE.

    // * * * CHECKOUT
    //ExpiryDateField::set_short_months(true); //uses short months (e.g. Jan instead of january) for credit card expiry date.
    //OrderFormWithoutShippingAddress::set_fixed_country_code("NZ"); //country is fixed
    //OrderFormWithoutShippingAddress::set_postal_code_url("http://maps.google.com"); //link that can be used to check postal code
    //OrderFormWithoutShippingAddress::set_postal_code_label("click here to check your postal code"); //label for link that can be used to check postal code
    //OrderFormWithoutShippingAddress::set_login_invite_alternative_text('<a href="http://www.mysite.com/Security/login/?BackURL=">If you are a member then please log in.</a>); //label for link that can be used to check postal code

    // * * * MEMBER
    //EcommerceRole::set_group_name("Customers");

    // * * * MODIFIERS
    //FlatTaxModifier::set_tax("0.15", "GST", $exclusive = false);
    SimpleShippingModifier::set_default_charge(2);
    SimpleShippingModifier::set_charges_for_countries(array(
    'GB' => 0,
    ));
    //TaxModifier::::set_for_country($country = "NZ", $rate = 0.15, $name = "GST", $inclexcl = "inclusive"))

    // * * * HELP
    //Product::set_global_allow_purcahse(false); //stops the sale of all products
    // ------------------------------------------------------END ECOMMERCE MODULE CONFIG ------------------------------------------------------

    {/code]

  • marc79
    Avatar
    Community Member
    65 Posts

    Re: How i got the latest eCommerce trunk to work with paypal Link to this post

    Thought I had solved the issue with setting the default country to United Kingdom (GB) but this still isn't happening for me. Have tired all possible options I can think of to set this as default but nothing seems to work.

    Geoip::$default_country_code = "GB";

    Has anyone managed to get this working in ecommerce 0.8.2?

    Thanks

    Marc

  • GRiiDWeb
    Avatar
    Community Member
    60 Posts

    Re: How i got the latest eCommerce trunk to work with paypal Link to this post

    Hi,
    I was looking in ecommerce/code/control/ShoppingCart.php where all the country code stuff is -

    protected static $country_setting_index = 'ShoppingCartCountry';
          static function set_country_setting_index($v) {self::$country_setting_index = $v;}
          static function get_country_setting_index() {return self::$country_setting_index;}

       static function set_country($countryCode) {
          Session::set(self::get_country_setting_index(), $countryCode);
          $member = Member::currentUser();
          //check if the member has a country
          if($member) {
             $member->Country = $countryCode;
             $member->write()

    Is there someting in here to help?
    GW

  • marc79
    Avatar
    Community Member
    65 Posts

    Re: How i got the latest eCommerce trunk to work with paypal Link to this post

    HI GW,

    Thanks for your post. I'd been looking there and in the EcommerceRole.php file, trying to hardcode in the default setting but no luck so far.

    public static $defaults = array(
       "Country" => 'GB'
    );

  • marc79
    Avatar
    Community Member
    65 Posts

    Re: How i got the latest eCommerce trunk to work with paypal Link to this post

    Have managed to force default country to be GB by amending the EcommerceRole.php file as below:

       static function find_country() {
          $member = Member::currentUser();

          if($member && $member->Country) {
             $country = $member->Country;
          } else {
             if($country = ShoppingCart::get_country())
                return $country;
             
             // HACK Avoid CLI tests from breaking (GeoIP gets in the way of unbiased tests!)
             // @todo Introduce a better way of disabling GeoIP as needed (Geoip::disable() ?)
             if(Director::is_cli()) {
                $country = null;
             } else {
                $country = 'GB';
             }
          }

          return $country;
       }

    Not sure if it the best way to do this but it seems to work.

    Marc

  • CHD
    Avatar
    Community Member
    218 Posts

    Re: How i got the latest eCommerce trunk to work with paypal Link to this post

    Sorry that I wasn't involved at all since starting this post! somehow i managed to unsubscribe myself without meaning to...I hope that you managed to get it working in the end.
    looking at starting a new eCommerce site soon so will probably be active again in this thread!

  • GRiiDWeb
    Avatar
    Community Member
    60 Posts

    Re: How i got the latest eCommerce trunk to work with paypal Link to this post

    Many thanks for joining again.
    I've not had a rush of orders as yet.... well none at all, but I haven't promoted the site at all.
    The commerce is live and in testing. It's sort of a hybrid of different version. It's not perfect, but there is not much support for the module UK to work with local developers.

  • marc79
    Avatar
    Community Member
    65 Posts

    Re: How i got the latest eCommerce trunk to work with paypal Link to this post

    Hi CHD,

    Yeah, got there in the end. It's a great module just needs a bit more documentation. Hopefully the bits I have posted to this thread may come in handy for others building site with the module.

    I've had it live on a clients site, http://www.margotdance.com, for just a few days and have had orders through so all seems to be going well.

    Cheers

    Marc

    6200 Views
Page: 1 2 3 4 5
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.