Mr Justice Phillips had heard how the deal, which allows a company in the Sports Direct group to sell replica Rangers kits and other branded products, was expiring.
He had been told that bosses at Rangers wanted to sign a new deal with a third party but SDI Retail Services executives objected and said they should have a chance to match any new offer.
The judge had been due to analyse evidence about the meaning of a contract clause at a High Court trial in London on Monday.
But lawyers representing both sides told him that out-of-court agreements had been made.
The judge said Rangers had accepted claims made by SDI bosses.
He said Rangers and SDI were negotiating another deal.
“You are going to get your new contract with Rangers,” he told lawyers representing SDI.
“I would really have thought the time has come to try to make peace.”
He added: “You have succeeded in matching and you are proceeding to a new contract.”
The judge was told that more than £500,000 had been spent on lawyers, with SDI running up legal costs of £350,000 and Rangers £185,000.
Mr Justice Phillips said Rangers’ bosses should pick up the vast majority of SDI’s legal bills as well paying their own fees, adding SDI was “entitled to the costs”.
William McCormick QC, who led the Rangers’ legal team, complained the £350,000 spent by SDI was “way over the top”.
Lawyers representing SDI disagreed.
Bosses at Rangers were involved in a High Court dispute with Mr Ashley in 2017.
SDI bosses complained Rangers’ directors had wrongly terminated a deal through which branded products were sold.
Rangers’ directors disputed the claim and asked a judge to call a halt to the litigation.
Judge Richard Millett made a ruling in Mr Ashley’s favour and decided the litigation could continue.
Mr McCormick told Judge Millett how fans had become angry after learning the club got about 7p of every £1 spent and had staged a merchandise boycott.
He said fans thought Mr Ashley pocketed too much of their money and said there was a widespread view that no “self-respecting” Rangers’ supporter wore a replica shirt.
Mr Justice Phillips has been told the boycott is over.