Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Order Status Available For Vendor Rate Topic   - - - - -

 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 08 December 2015 - 12:50 PM #1

Can we somehow restrict the vendor accounts to be only able to set the order status to a specific set of Order Status only. e.g. Shipped / Cancelled

 

Rest of the Order Status can only be done by the Admin group members.


Warm Regards,
Admin | MVE: 4.2.4

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 08 December 2015 - 09:12 PM #2

Unfortunately, it is not possible without additional code modifications


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11248 posts

Posted 08 December 2015 - 11:00 PM #3

You should be able add an orders.post.php controller that will modify the order statuses if $runtime.company_id is not zero so the only displayed values will be those that you want the vendor to be able to change to.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • galtinbaeva
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 06-Dec 13
  • 3303 posts

Posted 09 December 2015 - 07:02 AM #4

Code modification is required.


Simtech Development | sales@simtechdev.com | www.simtechdev.com
CERTIFIED CS-CART PARTNER | LICENSES | DEVELOPMENT | ADD-ONS | DESIGN | UPGRADE

Google Analytics Enhanced Ecommerce - get advanced ecommerce analytics


 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 12 January 2016 - 06:43 AM #5

You should be able add an orders.post.php controller that will modify the order statuses if $runtime.company_id is not zero so the only displayed values will be those that you want the vendor to be able to change to.

 

Hi tbirn,

 

I figured out there is already a hook for the same in details.tpl

 

Please guide me which var will be changed for this since I want the Vendors should be only able to mark the Order either Shipped (S) or Cancelled ( C )

{hook name="orders:order_status"}
                            {if $order_info.status == $smarty.const.STATUS_INCOMPLETED_ORDER}
                                {assign var="get_additional_statuses" value=true}
                            {else}
                                {assign var="get_additional_statuses" value=false}
                            {/if}
                            {assign var="order_status_descr" value=$smarty.const.STATUSES_ORDER|fn_get_simple_statuses:$get_additional_statuses:true}
                            {assign var="extra_status" value=$config.current_url|escape:"url"}
                            {if "MULTIVENDOR"|fn_allowed_for}
                                {assign var="notify_vendor" value=true}
                            {else}
                                {assign var="notify_vendor" value=false}
                            {/if}

                            {$statuses = []}
                            {assign var="order_statuses" value=$smarty.const.STATUSES_ORDER|fn_get_statuses:$statuses:$get_additional_statuses:true}
                            {include file="common/select_popup.tpl" suffix="o" id=$order_info.order_id status=$order_info.status items_status=$order_status_descr update_controller="orders" notify=true notify_department=true notify_vendor=$notify_vendor status_target_id="content_downloads" extra="&return_url=`$extra_status`" statuses=$order_statuses popup_additional_class="dropleft"}
                        {/hook}

Warm Regards,
Admin | MVE: 4.2.4

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11248 posts

Posted 12 January 2016 - 07:49 AM #6

You can either change the line of:
{$statuses = []}
or make an override hook and copy what's enclosed in the hook to the file and then change that line to be:
{if "MULTIVENDOR"|fn_allowed_for && $runtime.company_id}
  {$status = ['S', 'C']}
{elseif !$runtime.company_id}
  {$status = []}
{/if}
I would probably do it as an override to prevent making distributed code modifications.
Note that above is UNTESTED.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 12 January 2016 - 10:13 AM #7

Didnot work out. Its strange that still all the values are listed in popup both from admin and vendor account. Is there some place else which affects this code ? I did an override in order_status.override.tpl file in my_changes / hooks / orders


Warm Regards,
Admin | MVE: 4.2.4

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11248 posts

Posted 12 January 2016 - 06:57 PM #8

Should work, it would need debugging.  Happy to do this on the clock for you, but consulting is my business.  I'm happy to help where I can, but I can only go so far on forums.

 

I'm assuming you cleared your cache after making the changes.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 13 January 2016 - 08:28 AM #9

There is a mistake in the code. Try this one:
{if "MULTIVENDOR"|fn_allowed_for && $runtime.company_id}
  {$statuses = ['S', 'C']}
{elseif !$runtime.company_id}
  {$statuses = []}
{/if}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 13 January 2016 - 10:52 AM #10

There is a mistake in the code. Try this one:

{if "MULTIVENDOR"|fn_allowed_for && $runtime.company_id}
  {$statuses = ['S', 'C']}
{elseif !$runtime.company_id}
  {$statuses = []}
{/if}

Hi Ecom ,

 

I had already fixed that but the problem I am facing is in the file common/select_popup.tpl which uses this value for creating the order status. This variable $statuses is not used for creating the order status popup. See code below:

            {if $items_status}

                {foreach from=$items_status item="val" key="st"}
		
               
                <li {if $status == $st }class="disabled"{/if}><a class="{if $confirm}cm-confirm {/if}status-link-{$st|lower} {if $status == $st}active{else}cm-ajax{/if} {if $status_meta}{$status_meta}{/if}"{if $status_target_id} data-ca-target-id="{$status_target_id}"{/if} href="{"`$_update_controller`.update_status?id=`$id`&status=`$st``$extra_params``$dynamic_object`"|fn_url}" onclick="return fn_check_object_status(this, '{$st|lower}', '{if $statuses}{$statuses[$st].params.color|default:''}{/if}');" {if $st_result_ids}data-ca-target-id="{$st_result_ids}"{/if} data-ca-event="ce.update_object_status_callback">{$val}</a></li>

                {/foreach}
            {/if}

Here the status of orders in popup are created using a variable called $items_status whose values are filled using $order_status_descr 


{assign var="order_status_descr" value=$smarty.const.STATUSES_ORDER|fn_get_simple_statuses:$get_additional_statuses:true}
.
.
.
{assign var="order_statuses" value=$smarty.const.STATUSES_ORDER|fn_get_statuses:$statuses:$get_additional_statuses:true}

{include file="common/select_popup.tpl" suffix="o" id=$order_info.order_id status=$order_info.status items_status=$order_status_descr update_controller="orders" notify=true notify_department=true notify_vendor=$notify_vendor status_target_id="content_downloads" extra="&return_url=`$extra_status`" statuses=$order_statuses popup_additional_class="dropleft"}

So I donot want to touch the common code. It seems that we need to change the $items_status field to show only the selected Order Status in popup to Vendors. Correct me if my analysis is incorrect. And Thanks once again for helping out.


Warm Regards,
Admin | MVE: 4.2.4

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 13 January 2016 - 03:09 PM #11

OK. I see, in this case you should change the $order_status_descr variable. For example,

 

{assign var="order_status_descr" value=$smarty.const.STATUSES_ORDER|fn_get_simple_statuses:$get_additional_statuses:true}
{if "MULTIVENDOR"|fn_allowed_for && $runtime.company_id}
  {$order_status_descr = $order_status_descr|fn_correct_vendor_statuses}
{/if}

Then add new php function:

function fn_correct_vendor_statuses($statuses)
{
    foreach ($statuses as $k => $v) {
        if (!in_array($v['status'], array('S', 'C'))) {
            unset($statuses[$k]);
        }
    }
    return $statuses;
}

(!) Not tested

 
 

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 13 January 2016 - 09:20 PM #12

Thanks ecom it works with some modifications.  :-)


Warm Regards,
Admin | MVE: 4.2.4

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11248 posts

Posted 13 January 2016 - 09:39 PM #13

Be sure to post your final (working) solution for others.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 14 January 2016 - 09:04 AM #14


function fn_vendor_status_allowed($statuses,$selected)
{
    $allowed = array('I', 'E'); // I = Cancelled , E = Shipped

    array_push($allowed,$selected);
    foreach ($statuses as $k => $v) {
        if (!in_array($k,$allowed )) {
            unset($statuses[$k]);
        }
    }
    return $statuses;
}

Above is the final code.


Warm Regards,
Admin | MVE: 4.2.4

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 14 January 2016 - 09:43 AM #15

fleaffair, thank you


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • buging
  • Member
  • Members
  • Join Date: 12-Jan 11
  • 332 posts

Posted 19 December 2016 - 02:11 PM #16


function fn_vendor_status_allowed($statuses,$selected)
{
    $allowed = array('I', 'E'); // I = Cancelled , E = Shipped

    array_push($allowed,$selected);
    foreach ($statuses as $k => $v) {
        if (!in_array($k,$allowed )) {
            unset($statuses[$k]);
        }
    }
    return $statuses;
}

Above is the final code.

 

 

Where exactly did you place this code?

 

thanks!



 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 20 December 2016 - 08:15 AM #17

in app/addons/my_changes/func.php


Warm Regards,
Admin | MVE: 4.2.4

 
  • esbarro
  • Newbie
  • Trial users
  • Join Date: 05-Sep 16
  • 11 posts

Posted 28 January 2017 - 04:50 PM #18

There is an add-on for this http://marketplace.c...strictions.html