Display message orderwise in bigcommerce - bigcommerce

I want to display a message in Bigcommerce according orderwise. By default, Bigcommerce messages are displayed regulary.
Clearance :- I have placed 3 order with below order no
order #1
order #2
order #3
Default bigcommrec functionality
Messages of all order show with out orderwise(regularly)
My requirement
order #1
all message of order #1
order #2
all message of order #2
order #3
all message of order #3

Related

Shipping Report - Distinct Order with Two Dates - Status Missing from Table THEN

Links to the tables in the screenshot can be found at the link below:
https://www.dropbox.com/l/scl/AAAX85i7QE4zr1S-zr-_Lo00VUnIkE02XWo
First Issue:
Normally this table (See Load Tracking Table) would have a Field in Check Call Name that is "Pickup - Actual" signalling that this has been picked up. However in certain circumstances the CheckCallName will bypass the pickup and move to Delivered status. In cases like this I want to pull the query to treat the "Delivered" status in the same manner that Pickup Actual was being used.
Said another way, where kpo.loadtracking does not have Pickup - Actual in the Check Call Name field for any one order, I want to pull the Check Call Name for Delivered and the KeypointStatusDate.
Second Issue:
The DISTINCT clause does not work perfectly in my case, as an order can have the Pickup - Actual status updated multiple times. Here, we should take the oldest Keypoint Status Date. I've tried to use the MIN(KeypointStatusDate) and grouping by Order ID but I'm getting the following message
Msg 8120, Level 16, State 1, Line 14
Column 'KPO.LOAD.LoadId' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
The code I have currently is below. I'm new to SQL (about a week in) so apologies if this is simple.
SELECT
Distinct LOAD.LoadNumber
,LOAD.LoadId
,CustomerName
,OrderStatus
,CheckCallName
,PickedUpOn
,LoadTracking.KeypointStatusDate
,LOAD.OriginEarliest
,LOAD.DestinationEarliest
,CustomerRate
,CarrierCost
,Miles
FROM KPO.LOAD
Inner JOIN kpo.LoadExtension ON LOAD.LoadId = LoadExtension.LoadId
Inner JOIN kpo.Customer ON customer.CustomerId = LOAD.CustomerID
Inner JOIN kpo.LoadTracking ON LoadTracking.LoadId = LOAD.LoadId
WHERE
DATEDIFF(MONTH, GETDATE(), LoadTracking.KeypointStatusDate) = - 2
AND OrderStatus <> 'VOID'
AND CheckCallName = 'Pickup - Actual'
ORDER BY CustomerName, LoadNumber, LoadTracking.KeypointStatusDate
Load Tracking Table with Question Inside:
Data Result from Query:

AWQL AdWords API : how to retrieve CampaignStatus?

I'm using https://www.awql.me to build request and the first one below works, I'm successfully able to retrieve all campaigns with datas from past 7 days :
SELECT CampaignId, CampaignName, Clicks, Impressions
FROM CAMPAIGN_PERFORMANCE_REPORT
DURING LAST_7_DAYS
But when I try to add CampaignStatus and/or ORDER BY and/or LIMIT, I've got the following error message:
Underlying errors are
Type = 'QueryError.LIMIT_CLAUSE_NOT_SUPPORTED', Trigger = '', FieldPath = ''
There is below the request that cause the issue (I also tried to just use CampaignStatus, ORDER BY and LIMIT separately but the same error occured) :
SELECT CampaignId, CampaignName, Clicks, Impressions
FROM CAMPAIGN_PERFORMANCE_REPORT
WHERE CampaignStatus = 'Enabled'
DURING LAST_7_DAYS
ORDER BY Clicks DESC
LIMIT 0,5
I read that it's not possible to use ORDER BY and LIMIT with CAMPAIGN_PERFORMANCE_REPORT, so how do you guys get around this limitation to retrieve formated datas in the response, at a campaigns level ?
Did you find a way to make the status works in your AWQL request ?
Thanks a lot !
The problem with your CampaignStatus filter is that the status value should be ENABLED instead of Enabled.
As for LIMIT and ORDER BY, these are indeed not supported in AWQL. You'll have to process the data on your end.

Hybris How to distinguish if a voucher applies on order entry or on the order itself

How to show vouchers against products (order entry) in order details page.
In OrderData I see appliedVouchers but unable to distinguish voucher applied to which order entry.
final OrderData orderData = orderFacade.getOrderDetailsForCode(orderCode);
final List<VoucherData> voucherList = orderData.getAppliedVouchers();
flexible query to check which voucher is used in which order
select {vi.code}, {o.code} from
{ VoucherInvalidation as vi
join Order as o
on {o.pk} = {vi.order}
}
Basically voucher usage is stored in VoucherInvalidation

SQL & LINQ - Distinct by 2 columns and "reversed values"

I'm working on a chat system and need to get the inbox data for user 1119. This query should return the last message from each conversation.
A Message entity is made of a sender id (CreateUserId), receiver id (UserId), date (CreateDate) and message text (Desc)
EDIT: A "conversation" is a group of messages sent between two users. For example if the users are 1119 and 1120, the messages in the conversation are the ones with CreateUserId=1119, UserId=1120 OR CreateUserId=1120, UserId=1119.
The current query looks like this:
SELECT MAX(Id) Id, CreateUserId Sender,
UserId Receiver, MAX(CreateDate) Date, MAX([Desc]) Message
FROM [CarSharing].[dbo].[Message]
WHERE CreateUserId = 1119 OR UserId = 1119
GROUP BY CreateUserId, UserId)
THE ISSUE: The result gives out two messages from the same person, as the sender and receiver ids are switched. The row with the id 124 shouldn't be there
Ultimately, I'd like to implement this with LINQ, so solutions using that are also very welcome !
I am going to assume that a "conversation" is simply a message between two particular people. That seems to approximate your query.
You can't really do what you want with aggregation. Because the "max" of the message columns may not be the maximum date/time. Instead, use window functions:
SELECT m.*
FROM (SELECT m.*,
ROW_NUMBER() OVER (ORDER BY CreateDate DESC, id DESC) as seqnum
FROM [CarSharing].[dbo].[Message] m
WHERE 1119 IN (m.CreateUserId, UserId)
) m
WHERE seqnum = 1;
The ORDER BY in the windowing clause should be however you define the ordering. This is guessing that the creation date is first and then the id.

How to delete a sales order which is in sales order status?

I am a newbie to openerp. I have a sales order under the module 'sales' which is in 'Sales Order' status. The order number is 'SO019' . And i want to delete this sales order in the list.
When i tried to delete this sales order i got the following OpenErp Warning
Invalid Action!
In order to delete a confirmed sales order, you must cancel it.
To do so, you must first cancel related picking for delivery orders.
But i have no option to cancel this delivery in the 'warehouse/Delivery Orders'
Instead of this i have the following two options
Print Delivery Slip
Return Products
When i click onto the Return products i am getting the following warning
Warning!
No products to return (only lines in Done state and not fully returned yet can be returned)!
Is there anyway that i can delete this sales order(SO019) in the sales orders list?
Thanks in advance..
When you save the Confirm Sale Order, The Delivery Order is made. So first you need to cancel first delivery order. In Delivery Order has button name Cancel Transfer.
If your delivery order is in Delivered state than you can not delete Sale Order.
At first time for Delivery Order, click on Return Product. The reverse entry is create. You can see that entry in Incoming Shipment. for example IN/001-OUT/002-return entry is created.
Now At Second time you click on Return Product from the Same Delivery order as you do above step than you got your above warning. Because you can not return product twice for same Delivery Order.
Hope this will help you.
If the column status shows 'Sales Order' that means your invoice for that order is created and you can not delete sale order until you delete invoice related to it or order is cancelled.
To delete sale order with status 'Sale order',
Short way:
1] Just click on 'Cancel Order' [and its automatically deleted]
(But invoice related to it is go to cancel state and is visible)
Long way
1] Go to Accounting-> customer invoice
2]Cancel invoice for your sale order.[Invoice status changed to 'Cancelled']
3]Delete that invoice [More-Delete]
4]Go to Sale->Sale Order [Now status is Changed to 'Invoice Exception']
5]Now click on your sale order and then 'Cancel Order' [Now its automatically deleted]