Opencart: Pass quantity variable to success.php - variables

I have asked this question in the Opencart forums but have yet to receive any responses, so i thought i might ask the experts here #stackoverflow :)
I am trying to see exactly how i can pass the 'quantity' of the items ordered to the success.php page so i can then pass that to another php script that will generate an array based on the quantity.
This is my goal:
Customer Buys 5 items
Customer checks out and processes CC through Paypal Pro
Paypay returns a successful transaction
Now i want the success.php page to pass a variable($quantity) to
myNewScript.php page
myNewScript.php page will generate some random strings and then i
want to attach these random strings to the confirmation email that
opencart generates and sends to the customer.
Where should i start.

You will need to do this in checkout/success controller. Get the $quantity and use redirect function to redirect to your custom page:
$this->redirect($this->url->link('checkout/myNewScript','quantity='.$quantity));

Related

Prestashop add custom radio button on shipping carriers on front end checkout

I have created one custom module in Prestashop 1.7.8.7 which will add multiple shipping methods (Carrier) and will show shipping cost based on product dimensions and delivery address. So shipping carrier will look something like this on front-end checkout page. https://prnt.sc/E1avDASyJYYW
Now if someone select SameDay Courier Shipping then i need to show two radio button to select which service they want.
It will have two radio options like
Delivery pickup (by default this option will be selected)
Locker pickup
So if someone select Delivery pickup then it will have different shipping cost and if someone select Locker pickup then it will have different shipping cost.
Can anybody help me how can i achieve this functionality.
While digging, i found that we have file called DeliveryOptionsFinder.php and in that file we have one public function called getDeliveryOptions() where we have this line of code
if ($moduleId = Module::getModuleIdByName($carrier['external_module_name'])) {
$carrier['extraContent'] = Hook::exec('displayCarrierExtraContent', ['carrier' => $carrier], $moduleId);
}
}
So if i set is_module to 1 to all my carriers directly from DB then on frontend checkout page, no carriers is being displayed.
Thanks in advance.
I've already done something like this in the last 2 year as prestashop developer.
The truth is that you can't achieve what you want by "respecting" prestashop processes.
Maybe you can hook using a module the hookDisplayCarrierExtraContent($data) and then return the 2 radios if carrier is certain one (use $data).
But you can't handle a form submit or something else, or include it to prestashop checkout data.
But what you can do as workaround, for example, is the following.
In your module, as I said, hook the extra content, render a template with the 2 radios. Hook displayHeader too and use $this->context->controller->addJS() to add your own js if the current controller is the checkout one.
Then in this JS code you can handle the "change" event of the radios and send an ajax request to your module.
You can create inside {your_module}/controllers/front/ a controller called, for example, radio-choose and handle the js ajax request by saving inside your own table the choosen one.
Obviously you can disable the "next" button in checkout untill one of the two radios are selected, or maybe you can just set a radio button as default one to simplify.
For example your table "ps_cart_choosen_radio" could look like this |id_cart|choosen_radio|.
Then you have all the data you needed. When a cart is converted into an order you will have inside Order object (and ps_orders table as well) the id_cart.
Just select / join choosen radio from your own table by using order's id_cart.
"SELECT choosen_radio FROM ps_cart_choosen_radio WHERE id_cart = {$order.id_cart}"
If you need to show data depending on choosen_radio in frontend you can hook everywhere an order is present and select these data. Or maybe you can edit carrier name in ps_orders table by adding a piece of string. Let' say carrier is "express" and customer choosed "24h". You can update that column with carrier name by changing it to "express-24h" so around the whole prestashop ecosystem everybody will see that's a 24h choice.
Remember that the carrier name related to an order is not the carrier name inside the carriers table. So you can edit it without having trouble.
All these problems comes from the "need" to show some nested choices instead of listing all these in the main selections. In that case it would be easy (just create carrier in the prestashop backoffice)

ebay finding api finditemsbykeywords pagination problem

I tried the following calls:
https://svcs.ebay.com/services/search/FindingService/v1?X-EBAY-SOA-OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.13.0&keywords=waschbecken&RESPONSE-DATA-FORMAT=JSON&GLOBAL-ID=EBAY-DE&outputSelector(0)=ItemSpecifics&paginationInput.entriesPerPage=100&paginationInput.pageNumber=2
then on the ebay API explorer for the post request body,
<findItemsByKeywordsRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
<keywords>waschbecken</keywords>
<paginationInput>
<entriesPerPage>100</entriesPerPage>
<pageNumber>2</pageNumber>
</paginationInput>
</findItemsByKeywordsRequest>
but I do not get 100 searchResult count per page, in Postman I get 32 searchResult and in API explorer 56; furthermore 2nd page forward I do not get any searchResult count, I am trying to understand is there something wrong that I am writing in the call or there is some another problem or any parameter I am missing.
Thanks for the help.
I am also running into this problem. I am guessing that the pagination results are for the entire store, but not for the search by keywords....Seems like they dropped the ball on this.
Sorry, I did not update on the question, I forgot about it.
The problem was not with the pagination, the problem is the variants.
Simply explained, the output of the query doesn't count for the variants listed on the Ebay search by the same seller. If you have from a same seller the same product with the different variant, the query does not show the variants from those product from the same seller just different variant, as it would if you do an ebay search.
The mechanism of the query is different as that of the product search on Ebay.

getAllPrebidWinningBids() returns something but getAllWinningBids() is empty

I've been struggling with pbjs and DFP for several days now and my current problem is the one described in the title: when I type pbjs.getAllPrebidWinningBids() in the console, something is returned but nothing is displayed on my test page, and when I type pbjs.getAllWinningBids(), an empty array is returned and I don't get why.
A few more info :
This is a test page on our server with no other competition;
We use custom price buckets;
In DFP, I have 5 line items from 0.00€ to 2.00€ (so a 0.50€ increment) that matches the custom price buckets in the code;
The bids are "redirected" in the correct price buckets;
The code works and an ad is displayed when I set up a self-promotion
campaign in DFP with a prebid snippet as a creative, so I suppose
that something is wrong with the price buckets.
Would someone have an idea of what is blocking the selection of the bid and the rendering?
Thanks!
EDIT : I've come to realize that it was actually a normal behaviour since pbjs.getAllPrebidWinningBids() returns the bids that won the auction but haven't rendered on the page yet, while pbjs.getAllWinningBids() returns those that won but have also rendered.
So my question now is why the hell is no ad rendered at all?!
Here's my code (with a few dummy values), in case someone understand what's wrong: https://jsfiddle.net/8ewz9rgb/2/
Not answering the original thread question, instead your new issue why no ads are rendering. This is because you are calling GPT's googletag.disableInitialLoad. This will not render ads until googletag.refresh is called, which doesn't happen because it's in a 'pbjs' queue and you are not loading Prebid here, it is 404ing.

eBay API: get watch count for the particular item

I want to retrieve a number of watchers for the particular item using eBay API. I tried setting IncludeWatchCount to true in GetSingleItem request, but it appears that it works only for the seller of the item. Is it possible to get the number of watchers without being a seller?
I literally just joined in on SO with a new account because I lost my previous email with which I had the old one just to answer your question.
Anyway, If you call findItemsAdvanced, under listingInfo there is a watchCount field. It only works with findItemsAdvanced and not with any other.
[NOTE] The watchCount variable is not in the documentation. You should dump the response given by findItemsAdvanced, find listingInfo and it will be there

Shopify Get resourse_type at first when redirected to my application

My application is complete and work perfectly for Products.
Like i have an "application link" in the Products tab.On clicking, i get the SHOP name and ID of that product.Then i can successfully call the API because
GET /admin/products/#{id}/XXXX.json
by default i had use the "products" in path resolution.
Now the question is, at first I only got the ID with query parameter but don't know from which resource_type this belongs? i.e pages,themes etc.
Answer to this problem is that "you can append parameters to your query string" in Application Links.