I am looking to add FedEx SmartPost as a shipping option. Any idea what I need to do to accomplish this? The only information I have found on it is here https://drupal.org/node/793124, but it seems no one has solved this issue. I am willing to modify the ubercart fedex module if needed.
So far what I have done:
Changed RateService_v10.wsdl to RateService_v14.wsdl
Added code to the uc_fedex_rate_request function:
$request['RequestedShipment']['SmartPostDetail'] = addSmartPostDetail();
function addSmartPostDetail(){
$smartPostDetail = array(
'Indicia' => 'PARCEL_SELECT',
'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE',
'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION',
'HubId' => 5087,
'CustomerManifestID' => myid,
);
return $smartPostDetail;
}
In the uc_fedex_quote function, I have added a debug statement right after:
$response = uc_fedex_rate_request($packages, $origin, $destination);
drupal_set_message('<pre>'. print_r($response, TRUE) .'</pre>');
In the response I do not get SmartPost returned as an option.
This is what I had to do (note: I edited the uc_fedex.module directly):
You must get SmartPost approved for your account first
Get the updated wsdl file from https://www.fedex.com/us/developer/web-services/process.html?tab=tab1 and upload them to your server
Get a HubId from customer support (mine was 5185)
Get a CustomerManifestID from customer support
Change to RateService_v14.wsdl in the code (near $client = new SoapClient...)
Change the version to 14
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '14',
'Intermediate' => '0',
'Minor' => '0',
);
Add the following code:
$request['RequestedShipment']['SmartPostDetail'] = addSmartPostDetail();
function addSmartPostDetail(){
$smartPostDetail = array(
'Indicia' => 'PARCEL_SELECT',
'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE',
'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION',
'HubId' => yourhubid,
'CustomerManifestID' => yourmanifestid,
);
return $smartPostDetail;
}
Add the following to _uc_fedex_ground_services(): 'SMART_POST' => t('FedEx Smart Post'),
Go to admin/store/settings/quotes/methods/fedex and check 'FedEx Smart Post'
AllisonC's answer was very helpful. For anyone setting up SmartPost API calls with Drupal + Ubercart, here's how I built on her solution using FedEx Shipping 7.x-2.0+23-dev.
Download an updated RateService_vXX.wsdl file from http://www.fedex.com/us/developer/web-services/process.html?tab=tab1 (current version is v18). Open the wsdl file in a text editor and make sure it is connecting to the FedEx production server (currently ws.fedex.com:443/web-services/). Upload this file to /uc_fedex/wsdl-production/.
Edit the uc_fedex.module as follows (line numbers may vary, depending on how you edit the file):
Consider disable caching of SOAP WSDL while testing (line 19).
Define the addSmartPostDetail function as follows, outside the uc_fedex_quote function (I used line 248):
function addSmartPostDetail(){
$smartPostDetail = array(
'Indicia' => 'PARCEL_SELECT',
'HubId' => '5185', // use 5531 for testing only
);
return $smartPostDetail;
}
Inside the uc_fedex_quote function (line 271), call the addSmartPostDetail function.
$request['RequestedShipment']['SmartPostDetail'] = addSmartPostDetail();
Add the following to the _uc_fedex_ground_services() array (line 857):
'SMART_POST' => t('FedEx Smart Post'),
Define package dimensions (line 544). SmartPost has minimum container sizes of 6" L, 4" W, 1" H, and the module's hardwired settings are not adequate.
'Dimensions' => array(
'Length' => 6,
'Width' => 4,
'Height' => 1,
'Units' => 'IN',
),
I also manually patched the .module file using the patch at https://www.drupal.org/node/1782298 to avoid an unhelpful "Recoverable fatal error" notice if the request didn't work correctly.
Go to admin/store/settings/quotes/methods/fedex and check "FedEx Smart Post'.
My client needed to set conditions separately for Home Delivery and Smart Post, and didn't use any Express services, so I moved the 'SMART_POST' => t('FedEx Smart Post'), snippet to the _uc_fedex_express_services() array, enabled the FedEx Express method, and then set conditions accordingly.
Related
I'll try to explain my problem.
I do test on the site - mysite.com. But during the registration user should add credit card data. They can do it on https://checkout.stripe.com/pay.
This page is opened after click on Next button.
How can I add credit card data?
THanks
Go to cypress/support/commands.js and create a custom command like this.
Cypress.Commands.add('getStripeElement', (selector, value) => {
cy.get('iframe')
.should((iframe) => expect(iframe.contents().find(selector)).to.exist)
.then((iframe) => cy.wrap(iframe.contents().find(selector)))
.within((input) => {
cy.wrap(input).should('not.be.disabled').clear().type(value)
})
})
And then in your tests, you can add this:
cy.getStripeElement(
'input[data-elements-stable-field-name="cardNumber"]',
'4444222211110000'
)
cy.getStripeElement(
'input[data-elements-stable-field-name="cardExpiry"]',
'1025'
)
cy.getStripeElement('input[data-elements-stable-field-name="cardCvc"]', '123')
cy.getStripeElement(
'input[data-elements-stable-field-name="postalCode"]',
'90210'
)
Alternatively, there is a 3rd party plugin which provides the same custom command code as the one provided by Das.
https://github.com/dbalatero/cypress-plugin-stripe-elements
I have a question about programmatically updating a product via the Shopware 6 ProductRepository. I will update actionprices for my product.
But then rule Id is a required field. But how can I get this Rule ID field?
$price = [[
'linked' => false,
'net' => (float)$netPrice,
'gross' => (float)$grossPrice,
'currencyId' => Defaults::CURRENCY,
]];
$prices = [
[
'quantityStart' => 1,
'ruleId' => '???', // How can I get this???
'quantityEnd' => 10,
'price' => [
[
'currencyId' => Defaults::CURRENCY,
'gross' => $actionGrossPrice,
'net' => $actionNetPrice,,
'linked' => false
]
]
]
];
So how can I get this rule ID field?
Unfortunately you did not post the full code, especially the portion where you call the update function. I am assuming, that you are trying to set the "advanced pricing" of a product.
Before doing something programmatically, it might be a good idea to check how it's done manually.
In the admin panel (Shopware v6.4.3.0), creating advanced price rules also needs a rule id:
This refers to a rule created before unter Settings -> Shop -> Rule Builder.
There are some rules created by default, for example "all customers":
You can pick the rule ID from the URL when clicking that rule and use this in your code.
This might be fine if you write a plugin for one specific shop. But the rule would differ in other shops.
In case you are writing a plugin for a broader audience, I recommend to make the rule to be applied configurable in the plugin configuration.
You could of course also search programmatically for a rule "All customers" - but it might have been deleted by the shop owner.
For SEO purposes I need to remove the first page number from the URL. i.e I have the following:
example.com/pages/view/1 and example.com/pages/view the two URLs points to the same contents of the view action. I want to make the pagination free from 1 in the URL. i.e first Page link and Page Number 1 should be linked to pages/view.
I tried to deal with the $pagination object like the following:
$pages = new Pagination(['totalCount' => $books['booksCount'], 'pageParam' => 'start', 'defaultPageSize' => 10,]);
$pagingLinks = $pages->getLinks();
$pagingLinks['first'] = '/';
$pages->links = $pagingLinks;
However, the last line causing error:
Setting read-only property: yii\data\Pagination::links
So I have a problem to modify the links property. Is there any other solution to get this task done?!
According to docs you should set yii\data\Pagination::forcePageParam to false by passing it in Pagination constructor
$pages = new Pagination([
'totalCount' => $books['booksCount'],
'pageParam' => 'start',
'defaultPageSize' => 10,
'forcePageParam' => false,
]);
The above answer may works for direct use of Pagination but remain an issue if it was used from another widget such as ListView.
I found the solution from a comment on an issue report on Yii2 repository on github
The solution is just define proper route in config/web.php. Suppose here we have a controller called Suras and we use the ListView widget on its action's view called view. So placing rule array with defaults has value 'page' => 1 will prevent adding the page parameter to the link's URL of the first page. Also notice the first rule 'view/<id:\d+>/1' => 'Error404', is placed in-order to prevent any access to the first page using page=1 parameter, for example, trying to access mysite.com/view/20/1 will invoke 404 error, because there is no controller called Error404.
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'view/<id:\d+>/1' => 'Error404',
['pattern' => 'view/<id:\d+>/<page:\d+>', 'route' => 'suras/view', 'defaults' => ['page' => 1]],
'view/<id:\d+>/<page:\d+>' => 'suras/view',
'view/<id:\d+>' => 'suras/view',
],
],
],
Redirector plugin created by Shaun McCormick is a little outdated and I noticed that a bug appeared where not all resources showed up.
I first went to the repository to commit a fix in but the file annoyingly isn't being tracked. https://github.com/splittingred/Redirector
Fix:
Open: /core/componenets/redirector/processors/mgr/resources/getlist.class.php
Then add an initiator method:
public function initialize() {
$this->setDefaultProperties(array(
'start' => 0,
'limit' => 0,
'sort' => $this->defaultSortField,
'dir' => $this->defaultSortDirection,
'combo' => false,
'query' => '',
));
return true;
}
And that should be it. All resources will now show up.
Your problem is that you dont know about filtering.
all resouces list.
filtering
I have built a non-node module and I wish to integrate it with Open Atrium as a feature.
I've experimented with a test feature to try "crack the code" of features, spaces, and open atrium, as the documentation does not cover this topic and I'm new to features, spaces, and open atrium.
I created a feature using features and then customised the info and module files.
Info file:
core = "6.x"
description = "A test feature"
name = "Test Feature"
package = "Features"
spaces[types][] = "og"
features[][] = ""code here
Module file:
function test_feature_menu()
{
$items['ftest'] = array(
'title' => 'Test Feature',
'page callback' => 'test_feature_page',
'access callback' => 'spaces_menu_access',
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'features'
);
}
function test_feature_page()
{
$output = 'test';
return $output;
}
The feature appears in the features section, and when enabled, appears in the features menu regardless of what group I am in. Further, the groups have the feature set as disabled, but the item still appears in the menu.
Can anyone shed some light on this?
Thanks,
Greg.
Ok, I figured it out:
The access callback should be 'spaces_access_feature', and the access arguments should be array('view', 'test_feature');