πŸ‡ΈπŸ‡ͺSweden @cruze72

Account created on 19 February 2008, over 16 years ago
#

Recent comments

πŸ‡ΈπŸ‡ͺSweden cruze72

We are running the latest versions of all modules and still get the error.
commerce:2.36.0 and commerce_shipping:2.6.0, commerceguys/intl was 2.0.4 and physical 1.3.0

However, reverting to Physical 1.2 resolves the issue.

πŸ‡ΈπŸ‡ͺSweden cruze72

I've even tried injecting the above code directly as a custom views field rewrite. i can get a message printed but it shows 'out of stock' for all rows even when there is stock. I'm guessing that the issue lies with the field_stock.

πŸ‡ΈπŸ‡ͺSweden cruze72

I've tried the following code in a views template file like this:


views-view-field--my_view--default--field-stock.html.twig

{% if field_stock %}
  {% set stock = field_stock.0.value %}
  {% if stock >= 10 %}
    <span style="color: green">In stock</span>
  {% elseif stock > 0 and stock < 10 %}
    <span style="color: orange">Limited stock</span>
  {% else %}
    <span style="color: red">Out of stock</span>
  {% endif %}
{% endif %}

but still can't get the view to show the text instead of stock level ....

πŸ‡ΈπŸ‡ͺSweden cruze72

The setting for redirection is actually in the miniOrange configuration and overrides anything using Login Destination.

It's under the tab 'Login Settings' and then 'Advanced Settings' at the bottom of the page.

πŸ‡ΈπŸ‡ͺSweden cruze72

Yes ... thanks for this. Does seem to do what i want it to do. Have a few problems with conditions but events and actions work fine :)

πŸ‡ΈπŸ‡ͺSweden cruze72

Has anyone got this to work with Drupal 10? I have duplicates when using relationships on a view for commerce orders:
Order Item
User
(User Profile)

Here is the sql query:

SELECT DISTINCT "commerce_order"."order_number" AS "commerce_order_order_number", "commerce_order_item_commerce_order__order_items"."title" AS "commerce_order_item_commerce_order__order_items_title", "profile_users_field_data__profile__address"."address_given_name" AS "profile_users_field_data__profile__address_address_given_nam", "commerce_order"."order_id" AS "order_id", MIN(commerce_order.order_id) AS "order_id_1", MIN(commerce_order_item_commerce_order__order_items.order_item_id) AS "commerce_order_item_commerce_order__order_items_order_item_i", MIN(users_field_data_commerce_order.uid) AS "users_field_data_commerce_order_uid", MIN(profile_users_field_data.profile_id) AS "profile_users_field_data_profile_id"
FROM
{commerce_order} "commerce_order"
LEFT JOIN {commerce_order__order_items} "commerce_order__order_items" ON commerce_order.order_id = commerce_order__order_items.entity_id AND commerce_order__order_items.deleted = '0'
LEFT JOIN {commerce_order_item} "commerce_order_item_commerce_order__order_items" ON commerce_order__order_items.order_items_target_id = commerce_order_item_commerce_order__order_items.order_item_id
LEFT JOIN {users_field_data} "users_field_data_commerce_order" ON commerce_order.uid = users_field_data_commerce_order.uid
LEFT JOIN {profile} "profile_users_field_data" ON users_field_data_commerce_order.uid = profile_users_field_data.uid
LEFT JOIN {profile__address} "profile_users_field_data__profile__address" ON profile_users_field_data.profile_id = profile_users_field_data__profile__address.entity_id AND profile_users_field_data__profile__address.deleted = '0'
GROUP BY "commerce_order"."order_id", "commerce_order_order_number", "commerce_order_item_commerce_order__order_items_title", "profile_users_field_data__profile__address_address_given_nam"
LIMIT 100 OFFSET 0

The output prints every created profile from all orders on the site against every single order. ie 20 orders, 20 profiles thus 400 entries.
The duplicates are removed as soon as the (User)Profile relationship is removed.

Production build 0.71.5 2024