yeah, I clear cache every single I time modify the file. I also implemented the hook_theme_suggestions_HOOK(). Created unique templates too but nothing changes. I really don't understand what am I doing wrong. Here's my .module file code:
/**
* Implements hook_theme_suggestions_HOOK() for commerce_order_receipt.
*/
function commerce_latpay_theme_suggestions_commerce_order_receipt(array $variables) {
$suggestions = [];
// Get the order object from the variables.
$order = $variables['order'];
// Add a suggestion based on the order status.
$status = $order->getState()->getId();
$suggestions[] = 'commerce_order_receipt__' . $status;
return $suggestions;
}
/**
* Page callback to display order receipt for successful payments.
*/
function commerce_latpay_success_orders_page() {
// Load orders with status code "00" (success).
$query = \Drupal::entityQuery('commerce_order')
->condition('state', 'completed')
->condition('field_status_code', '00');
$order_ids = $query->execute();
// Load the orders.
$orders = \Drupal\commerce_order\Entity\Order::loadMultiple($order_ids);
// Render the template with the orders.
return [
'#theme' => 'commerce_order_receipt_success',
'#orders' => $orders,
];
}
Hi, Thanks for the response. However I have already tried hook theme() , it doesn't make any change. The order messages is still same. Look at my code;
/**
* Implements hook_theme().
*/
function commerce_latpay_theme($existing, $type, $theme, $path) {
return [
'commerce_order_receipt' => [
'variables' => [
'order' => NULL,
'transaction_id' => NULL,
'merchant_ref_number' => NULL,
],
'template' => 'commerce-order-receipt',
],
];
}
Hi, all. I'm on drupal 10.1.6, also facing this issue while redirecting to payment gateway(I'm building the module bdw). I did several things which are given in diff drupal threads but none worked for me.
In last 3 days list of things I did :
-> Enabling permission nodes, blocks, content, commerce related permission for anonymous user (including bypass access control permission) in admin/people/permissions.
-> Tried Rebuilding permissions.
-> Updating "entity, inline entity, commerce, profiles, state_machine" modules which were pending for updates.
-> Adding
requirements:
_access: 'TRUE'
in my route file.
-> Deleting module.route.yml file from folder.
-> Commenting out "onReturn, onCancel" functions code to check if that were responsible.
None of them worked. The "ACCESS DENIED" error is immortal. I can't get rid of this. I'm running out of options how to resolve this.. Please can anybody help me in anyway.
Same Access denied error. Please Help anyone!!!!! I tried rebuilding permission, enabling all permission for anonymous user still getting same "access denied" error again and again. I'm stuck for almost 2 days now, there has to be some solution for it out there.
I recently faced this error too. Almost after wasting 2 days trying to find solutions, I confirm that the solution in #9 worked in Drupal 10. Thanks.