I want to show the dropdown on the order success page if the user is first time ordering in the website..
I am following this way but its not working for me
<?php
namespace NamespaceModuleBlock;
class Test extends MagentoFrameworkViewElementTemplate
{
protected $orderFactory;
public function __construct(
MagentoSalesModelOrderFactory $orderFactory
) {
$this->orderFactory = $orderFactory;
}
public function getFirstOrder($emailId){
$emailId = '[email protected]';
$order = $this->orderFactory->create()->getCollection()->addAttributeToSelect('customer_email')
->addFieldToFilter('customer_email',array('eq'=>$emailId))->getFirstItem();
if($order->getCustomerEmail()){
echo 'second time order';
}
else{
echo 'first time order';
}
}
How can i achieve this.
thanks.!